Statistics
You've probably heard the term statistics bandied about in discussions of SQL Server query performance. Statistics are meta-data that SQL Server maintains about index keys and, optionally, nonindexed column values. SQL Server uses statistics to determine whether using an index could speed up a query. In conjunction with indexes, statistics are the single most important source of data for helping the optimizer develop optimum execution plans. When statistics are missing or out-of-date, the optimizer's ability to formulate the best execution plan for a query is seriously impaired.
Let's cover a few basic statistics-related terms before we discuss statistics in more depth.
Cardinality
The cardinality of data refers to how many unique ...
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