Explain plan 예제
작성자 관리자 작성시간 2016-02-23 18:19:09
 

$sqlplus "/as sysdba"
SQL> start C:\oracle\product\11.2.0\dbhome_1\sqlplus\ADMIN\plustrce.sql

grant plustrace, dba to scott;

$sqlplus "scott/tiger"
SQL> start C:\oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlxplan.sql

SQL> explain plan set statement_id='dba'
        for select * from big_emp where deptno = 10;

SQL> SELECT cardinality "Rows", lpad(' ',level-1)||operation||' '||options||' '||object_name "Plan"
  FROM PLAN_TABLE
CONNECT BY prior id = parent_id
        AND prior statement_id = statement_id
  START WITH id = 0
        AND statement_id = 'dba'
  ORDER BY id;
 
SQL> SELECT PLAN_TABLE_OUTPUT from TABLE (DBMS_XPLAN.DISPLAY());

SQL> set autotrace trace; 또는 set autotrace on; <= SQL문이 실행될 때마다 자동으로 화면에 출력
SQL> truncate plan_table;
SQL> set autotrace off;


목록 | 입력 | 수정 | 답변 | 삭제