Tuesday, September 23, 2008

Using oracle explain plan

1) Make sure the plan table is present
desc plan_table

2) If not, create it
@?/rdbms/admin/utlxplan

3) If the plan_table is old version, drop it then re-create using (2).
drop table plan_table;

4) Run the "explain plan for my_sql_statement"
EXPLAIN PLAN FOR
select * from emp;

5) Query the plan
set linesize 132
SELECT * FROM TABLE( dbms_xplan.display);


Reference:
http://www.orafaq.com/wiki/SQL*Plus_FAQ

No comments: