Free eBook “SQL Server Statistics” from Simple-Talk. Holger Schmeling’s work in SQL Server Distribution Statistics was first published as a pair of long articles for Simple-Talk.
Book Description
The booklet takes a practical, and well-informed approach to a subject that is not always easy to explain or understand. A Distribution Statistics object is a sampled map of the distribution of data in a table. Such statistics help the Query Optimizer of SQL Server’s Database Engine to translate the ‘logical’ SQL Query into the best strategy for doing all the physical operations of joining, sorting, and selecting the data. Most of the time, this work happens effectively without the database administrator having to be aware of what is going on, but occasionally, if the statistics no longer reflect what is actually in the table, then queries can suddenly run grindingly slow. At this point, the DBA must intervene to correct the problem.
Table of Contents
- Queries, Damned Queries and Statistics
- Prerequisites
- Statistics and execution plan generation
- Introductory Examples
- Under the hood
- A more detailed look at the utilization of statistics
- Statistics generation and maintenance
- Part 2: SQL Server Statistics: Problems and Solutions
- There is no statistics object at all
- Perfect statistics exist, but can’t be used properly
- Statistics is too imprecise
- Stale statistics
- No automatic generation of multi-column statistics
- Statistics for correlated columns are not supported
- Updates of statistics come at a cost
- Memory allocation problems