An Index Only Helps When the Value You Filter On Is Rare Enough
Sits directly on the index-structure node and is the first thing that stops 'add an index' from being a reflex. It is the precondition for the composite-column-order node, which is largely a selectivity-ordering decision, and for reading a plan without being surprised that a perfectly good index was declined. The outcome demands the learner explain a slow statement with numbers; selectivity is where the numbers first appear.
Questions this Concept answers
Why does an engine sometimes decline a perfectly valid index on a status column?
J
jeremy
Text
Designing the Right PostgreSQL Index Using Query Plans and Statistics
Adding an index is not automatically a win. Whether it helps depends on how rare the value you filter on is: if a column has only nine distinct values, filtering on one of them still leaves a ninth o…