Wednesday, July 30, 2014

How to get explain plan from the database


How to get explain plan from the database

We would like to get explain plan for a SQL statement. The SQL statement is,

Select * from gl_interface

Execute the following code to generate the explain plan
1
2
3
4
5
EXPLAIN PLAN
SET
STATEMENT_ID = 'ray'
FOR
SELECT * FROM gl_interface;

After executing the previous statement you need to extract the explain plan from the database. Execute the following,

1
2
SELECT *
  FROM TABLE (DBMS_XPLAN.display ('plan_table', 'ray'));

On executing this SQL you will get,



You can now see the explain plan in the output of the query.



Challa.

No comments:

Post a Comment