Join Statistics
summary
Planner misestimates cause huge costs — a real case shows 193 million vs 4 rows (7.68 orders of magnitude) which forces JIT startup and makes execution 5,000× slower. Proposal adds optimizer views stored in pg_class that point to a base relation plus a flag, letting the planner use sampled join statistics collected by probing indexes from a row sample instead of only per-table stats. Proofs of concept report about 1.5–2× query improvement; collection uses index probes or ephemeral relations and avoids materialized view storage or fragile incremental maintenance.
AI-written summary · about
chapters (26)
- 0:00Introduction
- 0:24Star join problem
- 1:07Estimate miscalculation example
- 3:34Current statistics limitations
- 4:56Extended statistics explained
- 6:41Problems with materialized views
- 8:29Existing solutions overview
- 10:18Introducing join statistics
- 11:40Proof of concept improvements
- 13:05Statistics storage options
- 18:06DB2 optimizer statistics
- 20:37Planner integration challenges
- 23:32Optimizer view limitations
- 27:06Statistics collection methods
- 29:36Proposed solution summary
- 31:24Default optimizer stats debate
- 33:11Performance improvements
- 34:46Q&A introduction
- 35:32Incremental materialized views
- 36:37View optimization questions
- 40:36Subset query handling
- 42:04Pairwise vs combined statistics
- 43:49Query planning complexity
- 45:59Syntax consistency concerns
- 47:23Star join optimization
- 48:47Statistics invalidation
