Carlos Sierra's Tools and Tips

Tools and Tips for Oracle Performance and SQL Tuning

YASTS: Yet Another SQL Tuning Script: planx.sql

with 6 comments

Having SQLTXPLAIN and SQLHC available, WHY do I need yet another way to display execution plans?

New script planx.sql reports execution plans for one SQL_ID from RAC and AWR. It is lightweight and installs nothing. It produces list of performance metrics for given SQL out of gv$sqlstats, gv$sqlstats_plan_hash, gv$sql and dba_hist_sqlstat. It also displays execution plans from gv$sql_plan_statistics_all and dba_hist_sql_plan. It is RAC aware. It also reports on io_saved when executed on Exadata.

Most stand-alone light-weight scripts I have seen only report plans from connected RAC node. This script reports from all RAC nodes. The AWR piece is optional. In other words, if your site does not have a Diagnostics Pack License you can specify so when executing this script, thus all access to AWR data is simply skipped. Output is plain text and it executes in seconds.

I will be using this planx.sql as my first step in the analysis of queries performing slowly. If I need more, then I will use SQLHC or SQLTXPLAIN. This planx.sql script, as well as some others, are beginning to populate my new shared directory of “free” scripts. The link is at the right of the screen, and also here. Quite often I write small scripts to do my job, now they will have a new house there. A readme provides a one-line description of each script.

Conclusion

New planx.sql is an alternative to plain DBMS_XPLAIN.DISPLAY_CURSOR. It displays plans from all RAC nodes and from AWR(opt). It also reports relevant performance metrics for all recorded execution plans. It is fast and installs nothing.

Written by Carlos Sierra

October 9, 2013 at 6:06 pm

6 Responses

Subscribe to comments with RSS.

  1. Hi Carlos,

    I was looking for something lightweight and quick, thanks for sharing

    regards
    Rama

    Rama

    October 10, 2013 at 7:14 am

  2. Hi Carlos,

    Thanks for sharing such a nice piece of information, I was looking something like this.

    Regards,
    Amit S.

    Amit Saraswat

    October 11, 2013 at 2:28 am

  3. Can you please share the script once more, I was unable to download as the page is not responsive.

    Neil

    July 1, 2023 at 3:15 pm


Leave a comment