SQL Server Interview Question #203
What causes inaccurate cardinality estimates?
Advanced Query Optimization Senior Advanced
Detailed Explanation
Common causes include stale or insufficient statistics, skewed data, correlated columns, complex predicates, parameter sensitivity, table variables in some scenarios, expressions or functions applied to columns, implicit conversions, and optimizer assumptions that do not match the actual data.
The solution depends on the cause. Possible actions include updating or improving statistics, rewriting predicates, using appropriate indexes, changing data modeling, or addressing parameter-sensitive behavior.
Do not assume that every estimate mismatch should be fixed; focus on mismatches that materially affect plan quality.