首页 > 代码库 > SQL Tuning 基础概述02 - explain plan的使用

SQL Tuning 基础概述02 - explain plan的使用

1.explain plan的使用

SQL> explain plan for delete from t_jingyu;Explained.SQL> select * from table(dbms_xplan.display);PLAN_TABLE_OUTPUT--------------------------------------------------------------------------------------------------------------------------------------------Plan hash value: 1368587462-----------------------------------------------------------------------| Id  | Operation          | Name     | Rows  | Cost (%CPU)| Time     |-----------------------------------------------------------------------|   0 | DELETE STATEMENT   |          |  1864K|   978   (2)| 00:00:12 ||   1 |  DELETE            | T_JINGYU |       |            |          ||   2 |   TABLE ACCESS FULL| T_JINGYU |  1864K|   978   (2)| 00:00:12 |-----------------------------------------------------------------------Note-----   - dynamic sampling used for this statement (level=2)13 rows selected

 2.explain plan 只是显示执行计划,并不会真正执行delete语句·

SQL> select count(*) from t_jingyu;  COUNT(*)----------   2097152

 

SQL Tuning 基础概述02 - explain plan的使用