|
可使用如下口诀来查看目标SQL执行计划的执行顺序:先从最开头一直连续往右看,直到看到最右边的并列的地方;对于不并列的,靠右的先执行;如果见到并列的,就从上往下看,对于并列的部分,靠上的先执行。
举例:
SQL> explain plan for select t1.empno,t1.ename,t2.dname from emp t1,dept t2 where t1.deptno=t2.deptno;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 615168685
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 14 | 770 | 6 (0)| 00:00:01 |
|* 1 | HASH JOIN | | 14 | 770 | 6 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL| DEPT | 4 | 88 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 462 | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("T1"."DEPTNO"="T2"."DEPTNO")
Note
-----
- dynamic sampling used for this statement (level=2)
19 rows selected.
根据以上口诀,我们可以知道,上面执行计划的执行顺序为2-3-1-0
|
|