Database Reference
In-Depth Information
Knowing the parent-child relationship is essential to understanding the order in which operations of an
execution plan are executed. In fact, parent operations, to fulfill their task, require data that is provided by their child
operations. As a result, even though execution starts at the root of the tree, the first operation to be fully executed is
one that has no child and, therefore, is a leaf of the tree. To illustrate, let's take a look at the following execution plan:
---------------------------------------------
| Id | Operation | Name |
---------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | SORT ORDER BY | |
| 2 | TABLE ACCESS BY INDEX ROWID| T |
| 3 | INDEX RANGE SCAN | T_PK |
---------------------------------------------
The operations are executed as follows:
1.
The entry point of the execution plan is operation 0, the root of the tree. However,
operation 0, a SELECT statement, has no data to work on. Hence, it has to call its child (1).
2.
Operation 1, a sort, has no data to work on. Hence, it has to call its child (2).
Operation 2, a table access, requires rowids to access the t table. Hence, it has to call its
child (3).
3.
4.
Operation 3, an index access, requires no data from another operation (it has no child).
Therefore, it carries out the index range scan on the t_pk index and passes the rowids it
finds to its parent (2).
Operation 2 uses the list of rowids it receives from its child (3) to access the t table. Then, it
passes the resulting data to its parent (1).
5.
6.
Operation 1 sorts the data passed by its child (2) and passes the resulting data to its parent (0).
7.
Operation 0 passes the data received from its child (1) to the caller.
even though the first operation being executed is always the root of the tree, parent operations (three in the
previous case) may do nothing other than to invoke a child operation. so, for simplicity, i usually say that the execution
starts with the first operation that can do some real work (this is operation 3 in the previous case).
Note
The following three general rules summarize the behavior just described:
Parent operations call child operations.
Child operations are fully executed before their parent operations.
Child operations pass data to their parent operations.
 
Search WWH ::




Custom Search