DISPLAY Function:Displays the contents of the plan table
display函数返回存储在计划表中的执行计划,即SQL还未执行
数据来自PLAN_TABLE
PLAN_TABLE:PLAN_TABLE is automatically created as a global temporary table to hold the output of
an EXPLAIN PLAN statement for all users. PLAN_TABLE is the default sample output table
into which the EXPLAIN PLAN statement inserts rows describing execution plans
DBMS_XPLAN.DISPLAY(
table_name IN VARCHAR2 DEFAULT 'PLAN_TABLE',
statement_id IN VARCHAR2 DEFAULT NULL,
format IN VARCHAR2 DEFAULT 'TYPICAL',
filter_preds IN VARCHAR2 DEFAULT NULL);
statement_id指定sql语句的名字,它的默认值是null,如果使用了默认值,将显示最近插入计划表中的执行计划
table_name指定计划表的名字,默认值是plan_table,所以在执行的SQL语句之前加上explain plan for后,select * from plan_table=select * from table(dbms_xplan.display)
DISPLAY_CURSOR Function:Displays the execution plan of any cursor in the cursor cache
display_cursor函数返回存储在库缓存中的执行计划,即SQL已经执行过的
数据来自V$SQL_PLAN ,所以display_cursor不需要先执行explain plan for,因为它不是读取计划表
V$SQL_PLAN:contains the execution plan information for each child cursor loaded in the library cache.
DBMS_XPLAN.DISPLAY_CURSOR(
sql_id IN VARCHAR2 DEFAULT NULL,
cursor_child_no IN NUMBER DEFAULT 0,
format IN VARCHAR2 DEFAULT 'TYPICAL');
sql_id指被返回执行计划的sql语句的序号,默认值是null,如果使用了默认值,当前会话的最后一条sql语句的执行计划将被返回。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30126024/viewspace-2136739/
,如需转载,请注明出处,否则将追究法律责任。