9i可以根据id和parent id来进行确定:
当某执行步骤(A)的parent_id 等于 另一个 执行步骤(B)的ID时,先执行A , 后执行B ,也就是大家所说的 “由右至左”
对于parent ID一样的两个执行步骤,是“先上后下”
select ename,dname
from emp, dept
where emp.deptno=dept.deptno
and dept.dname in ('ACCOUNTING','RESEARCH','SALES','OPERATIONS');
15 rows selected.
This produces the following explain plan:
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=8 Bytes=248)
1 0 HASH JOIN (Cost=3 Card=8 Bytes=248)
2 1 TABLE ACCESS (FULL) OF 'DEPT' (Cost=1 Card=3 Bytes=36)
3 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=16 Bytes=304)
如上的执行顺序是 2 3 1 0
在10g中执行顺序已经没有parent id了 这样就用到第二种确定执行计划顺序的方法:根据Operation区域来确定,the rightmost-uppermost operation of an explain
plan is executed first 最右最上的首先执行。
------------------------------------------------
Plan hash value: 615168685
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 14 | 588 | 7 (15)| 00:00:01 |
|* 1 | HASH JOIN | | 14 | 588 | 7 (15)| 00:00:01 |
|* 2 | TABLE ACCESS FULL| DEPT | 4 | 88 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 280 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------
执行顺序是 2 3 1 0
这两种方法都很好确定执行计划的执行顺序
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7794469/viewspace-886407/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7794469/viewspace-886407/