Independent senior database engineering · Pittsburgh, PAsbajwa@bajwaconsulting.com

Execution plan explainer

Paste an Oracle execution plan from DBMS_XPLAN or SQL*Plus AUTOTRACE. See what every step does in plain English, the order Oracle runs them, where the time and cost go, and what the autotrace statistics mean.

1 Paste an execution plan

Paste the whole output: the plan table, the Predicate Information, any Note and, from SQL*Plus AUTOTRACE, the Statistics block. Works with DBMS_XPLAN.DISPLAY, DISPLAY_CURSOR (including ALLSTATS LAST) and SET AUTOTRACE. Nothing leaves your browser.

How to get the best plan to paste

Best: actual figures per step. Run the query once with the hint, then display its last execution. No extra licence needed.

SET LINESIZE 300 PAGESIZE 0
SELECT /*+ GATHER_PLAN_STATISTICS */ ...your query... ;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST +COST +BYTES'));

Quick: estimates plus run statistics in SQL*Plus (needs the PLUSTRACE role or SELECT on the V$ views):

SET AUTOTRACE TRACEONLY EXPLAIN STATISTICS
SET TIMING ON
...your query... ;

Without running it:

EXPLAIN PLAN FOR ...your query... ;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);

For a statement already in the shared pool, use tuning/sql/sql_details.sql from the DBA scripts library.

Still slow?

Some plans need someone who can see the data, the statistics and the workload. A focused tuning session usually finds the fix quickly.

Database performance tuning