A query plan is a tree of physical operators with exact row counts.

highlighted = computed this step

A plan is an operator tree

A physical query plan is a tree of operators. Scans read base tables, filters keep rows, projects keep columns, and joins combine inputs. Note: data flows upward in the rendered tree.

operator tree\text{operator tree}

Rows on every node

The root result has recomputed row count 2 and arity 1. Note: every operator box displays its own exact row count.

rows=2,arity=1\text{rows}=2,\quad \text{arity}=1

cardinalities are exact counts on these tiny tables; choosing a plan by cost needs statistics and is deferred - no speed/perf claims; nested-loop vs hash is mechanism, not speed.

Operator tree project sid rows 2 filter course eq DB rows 2 scan Enroll rows 3 result sid s1 s2

Summary

A plan explains mechanism as a tree of physical operators and exact tiny-table cardinalities. Note: choosing by cost needs statistics and is deferred.

plan mechanism\text{plan mechanism}