Reading gporca (Part 2): The Reference-Count Gate That Turns Recursive Search into a Pausable Task Network

Query-optimizer search is inherently recursive: explore a group, derive plans, recurse into each input. The naive implementation is plain depth-first recursion. gporca doesn’t do that — it flattens the recursion into a task network, driven by a ready queue and a single reference counter. This post takes apart the most subtle piece: the m_ulpRefs reference-count gate. 1. m_ulpRefs is not a lifetime counter CJob::m_ulpRefs has three sources that must be read together: ...

October 20, 2026 · 4 min · daviszhen