Find out-of-date statistics and get it correct

The statistics object is the major source of information about data distribution for the predicate. Without knowing the exact data distribution, the query optimizer cannot have cardinality estimation, which is the process of calculating number of rows to return by applying the predicate.

After creating the statistics for the column, the column becomes out-of-date after executing DML commands, such as INSERT, UPDATE, and DELETE, because these commands change data, thereby affecting data distribution. In this scenario, a statistics update is needed.

In highly active tables, statistics become outdated in maybe a few hours; for static tables, statistics become outdated maybe in a few weeks. The decision ...

Get Microsoft SQL Server 2012 Performance Tuning Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.