Wednesday, August 24, 2011

Oracle explain plan


1. explain plan set statement_id = 'bad6' for
select a from b;

Then :

2. SELECT cardinality "Rows",
      lpad(' ',level-1)||operation||' '||
      options||' '||object_name "Plan"
 FROM PLAN_TABLE

CONNECT BY prior id = parent_id
       AND prior statement_id = statement_id
 START WITH id = 0
       AND statement_id = 'bad6'
 ORDER BY id;

OR

2. SELECT * FROM TABLE(dbms_xplan.display('PLAN_TABLE','bad6','ALL'));

No comments:

Blog Archive