Microsoft® SQL Server® 2008 Internals
by Paul Randal Kalen Delaney Kimberly Tripp, and Conor Cunningham
Statistics, Cardinality Estimation, and Costing
The Query Optimizer uses a model with estimated costs of each operator to determine which plan to choose. The costs are based on statistical information used to estimate the number of rows processed in each operator. By default, statistics are generated automatically during the optimization process to help generate these cardinality estimates. The Query Optimizer also determines which columns need statistics on each table.
Once a set of columns is identified as needing statistics, the Query Optimizer attempts to find a preexisting statistics object for that column. If it doesn’t find one, the system samples the table data to create a new statistics object. If one already existed, it is examined to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access