Lab 05 — Cardinality and Skew
Scenario
A query combines a hot-customer range with completed status. The generated data is intentionally skewed, so treating predicates as statistically independent can produce inaccurate row estimates.
Run the exercise
Investigate
- Compare estimated and actual rows at each relevant node.
- Inspect value distribution for
customer_idandstatus. - Explain how estimation errors influence scan, join, or sort choices.
- Consider whether ordinary statistics capture correlation between columns.
- Re-measure after any statistics experiment; do not infer success from planner cost alone.
Diagnostic question
Where does the first material estimate error appear, and what property of the dataset could explain it?