日期:2014-05-17 浏览次数:20813 次
SQL> select * from t where rownum=1; IDX ---------- CNAME -------------------------------------------- 1 a Execution Plan ---------------------- 0 SELECT STATEMENT Optimizer=CHOOSE 1 0 COUNT (STOPKEY) 2 1 TABLE ACCESS (FULL) OF 'T' Statistics ---------------------- 0 recursive calls 0 db block gets 0 consistent gets 0 physical reads 0 redo size 0 bytes sent via SQL*Net to client 0 bytes received via SQL*Net from client 0 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
------解决方案--------------------
要有
Execution Plan
----------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COUNT (STOPKEY)
2 1 TABLE ACCESS (FULL) OF 'T'
才能看得出,
你是不是用的
set autotrace on statistics
这样看不到 Plan
直接set autotrace on看看信息
------解决方案--------------------
1: 打开PL\SQL Developer工具,按F5 2:SET AUTOTRACE TRACEONLY; -- 安装执行计划 FYI: http://www.eygle.com/faq/AutoTrace.htm 如果想强制使用索引: -- 查索引NAME: SQL> SELECT TABLE_NAME, 2 INDEX_NAME 3 FROM ALL_INDEXES 4 WHERE TABLE_OWNER = UPPER('SCOTT') 5 AND TABLE_NAME = UPPER('EMP'); TABLE_NAME INDEX_NAME ------------------------------ ------------------------------ EMP PK_EMP SQL> SELECT /*+ INDEX(EMP PK_EMP)*/ EMPNO,ENAME 2 FROM EMP 3 WHERE EMPNO >= '7782'; EMPNO ENAME ----- ---------- 7782 CLARK 7788 SCOTT 7839 KING 7844 TURNER 7876 ADAMS 7900 JAMES 7902 FORD 7934 MILLER 8 rows selected