使用EXPLAIN PLAN获取SQL语句执行计划(二)

2014-11-24 08:53:45 · 作者: · 浏览: 8

,position pos
,bytes
,cost
FROM plan_table
START WITH id = 0
AND statement_id =upper( '&input_statement_id')
CONNECT BY PRIOR id = parent_id;

Enter value for input_statement_id: T1
old 9: AND statement_id =upper( '&input_statement_id')
new 9: AND statement_id =upper( 'T1')

OPERATION OPTIONS OBJECT_NAME POS BYTES COST
------------------------- ------------------------- ------------------------- ---------- ---------- ----------
CREATE TABLE STATEMENT 8 79000 8
LOAD AS SELECT T1 1
TABLE ACCESS FULL T 1 79000 5

--创建测试表t1并收集统计信息
scott@ORCL> create table t1 nologging as select * from t;

scott@ORCL> exec dbms_stats.gather_table_stats('SCOTT','T1');

--使用explain plan加载创建索引的执行计划
scott@ORCL> explain plan set statement_id='IDX' for create index i_t1 on t1(object_id);

Explained.