id, parent_id, lpad(' ', level) || operation || ' ' || options || ' ' || object_name as operation from plan_table start with id = 0 connect by prior id = parent_id) order by lvl desc, id; 执行计划
当一条SQL语句执行的时候将会生成该语句的实际执行计划。在语句被硬解析之后,所选的执行计划会被存到库高速缓存中以便以后重用。可以通过查询V$SQL_PLAN来查看计划运算。 Sql代码 收藏代码
select sql_id from v$sql where sql_text like '%TEST%'; select * from v$sql_plan where sql_id='7dfcmhhhxjspn' and child_number=0; 或者用以下语句来代替v$sql_plan select * from table(dbms_xplan.display_cursor('7dfcmhhhxjspn',null,'ALLSTATS LAST')); 也可以通过一条语句: SELECT * FROM TEST; SELECT XPLAN.* FROM (SELECT MAX(SQL_ID) KEEP(DENSE_RANK LAST ORDER BY LAST_ACTIVE_TIME) SQL_ID, MAX(CHILD_NUMBER) KEEP(DENSE_RANK LAST ORDER BY LAST_ACTIVE_TIME) CHILD_NUMBER FROM V$SQL WHERE UPPER(SQL_TEXT) LIKE '%SELECT * FROM TEST%' AND UPPER(SQL_TEXT) NOT LIKE '%FROM V$SQL WHERE UPPER(SQL_TEXT) LIKE %') SQLINFO, TABLE(DBMS_XPLAN.display_cursor(SQLINFO.SQL_ID, SQLINFO.CHILD_NUMBER, 'ALLSTATS LAST')) XPLAN; 上一页 [1] [2]
|