独立于SQL客户端的简单方法:
EXPLAIN PLAN SET STATEMENT_ID = 'yourTag' into plan_table FOR
select .... your query here ... from tab;
---
SELECT * FROM table(DBMS_XPLAN.DISPLAY('plan_table', 'yourTag','ALL'));
您将得到作为查询结果的完整执行计划。
这个
PLAN_TABLE
必须存在,并且必须授予您的用户读写权限。
查询的示例输出
select * from dual where dummy = 'X';
Plan hash value: 272002086
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS STORAGE FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
----------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / DUAL@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
1 - storage("DUMMY"='X')
filter("DUMMY"='X')
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "DUMMY"[VARCHAR2,1]