Enqueue
During an enqueue operation, an entry is put on the queue. The entry contains key values used by the recursive join predicates or data manipulated as a part of the recursion process. The optimizer always supplies an enqueue operation to collect the required recursive data on the query node directly above the Union All.
| Data Access Method | Enqueue |
|---|---|
| Description | Places an entry on the queue needed to cause further recursion |
| Advantages |
|
| Likely to be used | A required access method for recursive queries |
| Example SQL statement | |
| Database Monitor and Plan Cache record indicating use | There are no explicit records that indicate the use of an enqueue |
| SMP parallel enabled | Yes |
| Also referred to as | Not applicable |
| Visual Explain icon | ![]() |
Use the CYCLE option in the definition of the recursive query if the data reflecting the parent-child relationship could be cyclic, causing an infinite recursion loop. CYCLE prevents already visited recursive key values from being put on the queue again for a given set of related (ancestry chain) rows.
Use the SEARCH option in the definition of the recursive query to return the results of the recursion in the specified parent-child hierarchical ordering. The search choices are Depth or Breadth first. Depth first means that all the descendents of each immediate child are returned before the next child is returned. Breadth first means that each child is returned before their children are returned.
SEARCH requires not only the specification of the relationship keys, the columns which make up the parent-child relationship, and the search type of Depth or Breadth. It also requires an ORDER BY clause in the main query on the provided sequence column in order to fully implement the specified ordering.
