我有几个SQL查询具有非常低的查询运行性能,我想检查此查询的查询执行计划.我试图执行以下查询,但它没有显示任何查询执行计划.它唯一的显示消息计划FOR成功.我不知道是否有任何设置我们必须在oracle sql开发人员中查找解释查询计划:
EXPLAIN PLAN FOR Select SO.P_OPTION_ID FROM SIMSIM JOIN P_TYPE PT on PT.KEY=SIM.P_TYPE_KEY JOIN P_CONFIG PC ON PC.ID=PT.PRODUCT_CONFIG_ID JOIN P_OPTION PO ON PO.OPTION_KEY=PC.DEFAULT_PRODUCT_OPTIONS JOIN S_OPTION SO ON SO.SERVICE_ID=SIM.ASSIGNED_TO_SERVICE_ID JOIN AVV_NO AN ON SIM.ASSIGNED_ANUMBER_ID = AN.ID where SO.STATUS_ID IN (20,40) and SO.ID < to_char(SYSDATE - numtodsinterval ( 1,'MINUTE' ),'YYYYMMDDHH24MISS')||'0000' and SO.ID > to_char(SYSDATE - numtodsinterval ( 1,'HOUR' ),'YYYYMMDDHH24MISS')||'0000' and NOT EXISTS(SELECT ID from TEMP_BPL T WHERE T.ID = SO.ID );
EXPLAIN PLAN FOR
在sql Developer中,您不必使用EXPLAIN PLAN FOR语句.按F10或单击“解释计划”图标.
然后它将显示在“解释计划”窗口中.
如果您使用的是sql * Plus,请使用DBMS_XPLAN.
例如,
sql> EXPLAIN PLAN FOR 2 SELECT * FROM DUAL; Explained. sql> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT -------------------------------------------------------------------------- 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 FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 | -------------------------------------------------------------------------- 8 rows selected. sql>