Statistical information
SQL Server uses statistical information about the distribution of
values in a column to determine the optimal strategy for evaluating a query. Distribution
statistics help the system estimate how efficient an index would be in retrieving data
associated with a key value or range specified in the query.
Note: This topic applies only to on-premises
environments.
As the data in a column changes, index and column statistics can become out-of-date, affecting query performance. The statistics should be refreshed anytime significant numbers of changes to keys occur in the index.
We recommend that you update statistics nightly or weekly for best performance.
See Updating statistics.
You can use the
dbcc show_statistics
statement to generate a
report on the distribution statistics for an index. The statements in this section use this
syntax:
dbcc show_statistics (table_name, index_name)
The results indicate the selectivity of an index (the lower the density returned, the higher the selectivity) and provide the basis for determining whether an index is useful in optimizing queries.
For dbcc show_statistics
and other DBCC (Database Console
Commands) statements, see the SQL Server help.