Below reference clearly explains the order of execution plan.
http://www.dba-oracle.com/t_order_sequence_sql_execution_explain_plans_steps.htm
Cross verify results with below examples:
Example:
Query:
select /*+ gather_plan_statistics */
e.first_name,d.department_name,j.job_title,j.job_id
from
hr.employees e,
hr.departments d,
hr.jobs j
where
e.job_id=j.job_id
and e.department_id=d.department_id
and j.job_title in ('Purchasing Clerk','Marketing Manager','Administration Assistant')
--and e.first_name in ('Sigal','Alexander','Jennifer','Susan')
;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST')) ;
Plan:
order of id execution: 4,5,3,6,2,7,1,0
It follows "Left-Right-Center" at every node from leaf to top in tree.
It follows post order traversal. Refer this.
https://www.tutorialspoint.com/python_data_structure/python_tree_traversal_algorithms.htm
http://www.dba-oracle.com/t_order_sequence_sql_execution_explain_plans_steps.htm
Cross verify results with below examples:
Example:
Query:
select /*+ gather_plan_statistics */
e.first_name,d.department_name,j.job_title,j.job_id
from
hr.employees e,
hr.departments d,
hr.jobs j
where
e.job_id=j.job_id
and e.department_id=d.department_id
and j.job_title in ('Purchasing Clerk','Marketing Manager','Administration Assistant')
--and e.first_name in ('Sigal','Alexander','Jennifer','Susan')
;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST')) ;
Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
0 | SELECT STATEMENT | 1 | 7 | 00:00.0 | 19 | |||||
* 1 | HASH JOIN | 1 | 17 | 7 | 00:00.0 | 19 | 880K | 880K | 629K (0) | |
2 | NESTED LOOPS | 1 | 7 | 00:00.0 | 12 | |||||
3 | NESTED LOOPS | 1 | 17 | 7 | 00:00.0 | 9 | ||||
* 4 | TABLE ACCESS FULL | JOBS | 1 | 3 | 3 | 00:00.0 | 7 | |||
* 5 | INDEX RANGE SCAN | EMP_JOB_IX | 3 | 6 | 7 | 00:00.0 | 2 | |||
6 | TABLE ACCESS BY INDEX ROWID | EMPLOYEES | 7 | 6 | 7 | 00:00.0 | 3 | |||
7 | TABLE ACCESS FULL | DEPARTMENTS | 1 | 27 | 27 | 00:00.0 | 7 |
order of id execution: 4,5,3,6,2,7,1,0
It follows "Left-Right-Center" at every node from leaf to top in tree.
It follows post order traversal. Refer this.
https://www.tutorialspoint.com/python_data_structure/python_tree_traversal_algorithms.htm