# Oracle’s EXPLAIN PLAN

- ## To generate a plan:

  EXPLAIN PLAN SET STATEMENT_ID = 'Emp_Sal’ FOR
  SELECT ename, job, sal, dname
  FROM emp, dept
  WHERE emp.deptno = dept.deptno
  AND NOT EXISTS
  (SELECT * FROM salgrade
  WHERE emp.sal BETWEEN losal AND hisal);

- ## That writes plan details into a table which can be queried to yield results like this:

  ID PAR Query Plan
  --- --- --------------------------------------------------
  0 Select Statement Cost = 69602
  1 0 Nested Loops
  2 1 Nested Loops
  3 2 Merge Join
  4 3 Sort Join
  5 4 Table Access Full T3
  6 3 Sort Join
  7 6 Table Access Full T4
  8 2 Index Unique Scan T2
  9 1 Table Access Full T1

Previous slide | Next slide | Back to first slide | View graphic version