During a enqueue operation, an entry it put on the queue that 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 | WITH RPL (PART, SUBPART, QUANTITY) AS ( SELECT ROOT.PART, ROOT.SUBPART, ROOT.QUANTITY FROM PARTLIST ROOT WHERE ROOT.PART = '01' UNION ALL SELECT CHILD.PART, CHILD.SUBPART, CHILD.QUANTITY FROM RPL PARENT, PARTLIST CHILD WHERE PARENT.SUBPART = CHILD.PART ) SELECT DISTINCT PART, SUBPART, QUANTITY FROM RPL |
Messages indicating use | There are no explicit message 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 there is the possibility that the data reflecting the parent, child relationship may be cyclic, causing an infinite recursion loop. CYCLE will prevent 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, which columns make up the parent child relationship and the search type of Depth or Breadth but it also requires an ORDER BY clause in the main query on the provided sequence column in order to fully implement the specified ordering.