0

我试图了解 Oracle plan_table 并运行了几条 SQL 语句来填充 plan_table...从 plan_table 中生成的语句中,我如何确定语句的执行顺序。

在此处输入图像描述

4

1 回答 1

5

直接从 中选择PLAN_TABLE有点“弃用”。至少现在绝对没有必要。您可以使用dbms_xplan查看解释语句的执行计划:

explain plan for
select *
from your_table;;

select * 
from table(dbms_xplan.display);

手册中的更多详细信息:http: //docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_xplan.htm#CACICEDJ

该手册还包含一个示例(分层)SELECT语句,用于PLAN_TABLE直接从以下位置检索内容:

SELECT id, LPAD(' ',2*(LEVEL-1))||operation operation, options,
   object_name, object_alias, qblock_name, position 
FROM plan_table 
START WITH id = 0 AND statement_id = 'xxxxx'
CONNECT BY PRIOR id = parent_id AND statement_id = 'xxxxx'
ORDER BY id;

以上摘自:http ://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#sthref5965

您需要'xxxx'用您正在使用的 statement_id 替换(在语句中需要set statement_ida explain plan

于 2013-09-22T17:05:57.697 回答