5 Ways to Examine Cardinality Metrics

In SQL Server the query optimizer uses a cardinality estimator to answer data SELECTIVITY questions like the ones below. The optimizer uses this cardinality data, which relies heavy on statistics to get the answers and calculate a cost estimate. It takes the #of Rows to Satisfy a Predicate/Total # of Input Rows. How many rows will satisfy a single filter predicate? Multiple? WHERE How many rows will satisfy a join predicate between two tables? JOIN How many distinct values do we expect from a specific column? DISTINCT GROUP BY From this estimate the optimizer is able to find an efficient execution… Continue Reading