Auto Trace는 옵션에 따라서 퀴리수행결과, 실행계획, 실행통계를 선택적으로 출력할 수 있어서, SQL을 튜닝하는데 유용하다.
(쿼리수행결과, 실행통계는 실제로 수행해봐야 알수있는 결과고, 실행계획은 예측 결과)
SQL> set autotrace on
SQL> select *
2 from emp where empno=7900;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------
7900 JAMES CLERK 7698 81/12/03 950 30
Execution Plan
----------------------------------------------------------
Plan hash value: 2949544139
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 37 | 1 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 37 | 1 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | PK_EMP | 1 | | 0 (0)| 00:00:01 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("EMPNO"=7900)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
2 consistent gets
2 physical reads
0 redo size
835 bytes sent via SQL*Net to client
400 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
실제수행여부 | 수행결과 | 실행계획 | 실행통계 | |
---|---|---|---|---|
set autotrace on | O | O | O | O |
set autotrace on explain | O | O | O | |
set autotrace on statistics | O | O | O | |
set autotrace on traceonly | O | O | O | |
set autotrace on traceonly explain | O | |||
set autotrace on traceonly statistics | O | O |