Example PostgreSQL Execution (cont)
Execution: ExecutePlan() repeatedly invokes ExecProcNode() .
ExecProcNode() sees a NestedLoop node ...
so dispatches to ExecNestedLoop() to get next tuple
which invokes ExecProcNode() on its sub-plans
in left sub-plan, ExecProcNode() sees an IndexScan node
so dispatches to ExecIndexScan() to get next tuple
if no more tuples, return END
for this tuple, invoke ExecProcNode() on right sub-plan
ExecProcNode() sees a SeqScan node
so dispatches to ExecSeqScan() to get next tuple
check for match and return joined tuples if found
continue scan until end
reset right sub-plan iterator
Result: stream of result tuples returned via ExecutePlan()
|