日期:2014-05-16 浏览次数:20410 次
用于查看已执行的sql的执行计划:
?
SQL> select count(*) from abc;
? COUNT(*)
----------
??????? 10
SQL> select sql_id from v$sql where sql_text='select count(*) from abc';
SQL_ID
-------------
crrfjnb0y4mq1
SQL> select * from table(dbms_xplan.display_cursor('crrfjnb0y4mq1'));
PLAN_TABLE_OUTPUT
--------------------------------------------
SQL_ID? crrfjnb0y4mq1, child number 0
-------------------------------------
select count(*) from abc
Plan hash value: 1045519631
-------------------------------
| Id? | Operation????????? | Name | Rows? | Cost (%CPU)| Time???? |
-------------------------------
|?? 0 | SELECT STATEMENT?? |????? |?????? |???? 2 (100)|????????? |
|?? 1 |? SORT AGGREGATE??? |????? |???? 1 |??????????? |????????? |
PLAN_TABLE_OUTPUT
--------------------------------------------
|?? 2 |?? TABLE ACCESS FULL| ABC? |??? 10 |???? 2?? (0)| 00:00:01 |
-------------------------------
Note
-----
?? - dynamic sampling used for this statement
18 rows selected.
另外种灵活设置
select /*+gather_plan_statistics */ count(0) from abc
select * from table(dbms_xplan.display_cursor('crrfjnb0y4mq1',null,'all iostats last'));
....
?
?