Model
Order predicates by rows removed per unit of cost
It is the same ordering structure as scheduling jobs by value over work.
- Selectivity
- the fraction of rows that pass
- Cost
- the cost to evaluate it once
Worked examples, recomputed
Every number the mechanisms quote for this relationship is recomputed from it, so none of them disagrees with it.
- cheap compare: rank (1 − 0.9)/1 = 0.1
- UDF: rank (1 − 0.1)/100 = 0.009
- A then B over 1,000 rows → 91,000
- B then A → 100,100
Where it appears
Each mechanism states it in its own names. The general symbol each name stands for is shown with it.
- Query Planning & Optimization
How does a system choose a plan for a question when the facts that decide the best plan are unknown until the plan has run?