For every DML statement that you would execute at SQL promp you can obtain the execution plan for it, provided you have the plan_table created in ur schema.
If you don't have this plan_table created, then u hve to run the script file called utlxplan.sql (The name of the file may be a little different like utilxplan or utl_xplan or something like that - that you will have to check)
After running this script file it should create the plan_table.
Then you give
SET AUTOTRACE ON EXPLAIN PLAN
or
SET AUTOTRACE ON EXPLAIN STATISTICS
In the first case it will only show you plan. In the second case it will also show the plan and it will also show the statistics.
Guys -
PLAN_TABLE output shows the execution plan that Oracle intend to use to execute the query. There is no gaurentee that this execution plan is THE plan that is used during execution. This is because the execution environment might be different for different users executing the same query. For instance the execution environment depends on "SORT_AREA_SIZE" , "HASH_AREA_SIZE" etc. Hence looking at the plan_table is a rough way of estimating what Oracle might use to execute the query.
However there is a new feature introduced in 9i where the actual plan used by Oracle can be viewed. This is by means of querying V$SQL_PLAN. Refer Oracle manual for 9i to know more about it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.