Thursday, October 29, 2009

Explain Plan Setup

SQL*Plus: Release 9.2.0.1.0 - Production on Thu Oct 29 14:46:26 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

1. Creation of the plan table.
SQL> @E:\TestDB\rdbms\admin\utlxplan.sql
Table created.

SQL> create table t( num number(2));
Table created.

SQL> delete from plan_table;
0 rows deleted.

2. Collect the plan for SQL script.
SQL> explain plan for 2 select * from t where num = 2;
Explained.

3. View the Explain plan.

SQL> @E:\TestDB\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

--------------------------------------------------------------------
Id Operation Name Rows Bytes Cost
--------------------------------------------------------------------
0 SELECT STATEMENT
* 1 TABLE ACCESS FULL T
--------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT

--------------------------------
1 - filter("T"."NUM"=2)
Note: rule based optimization
14 rows selected.

SQL>

0 comments:

Post a Comment