Share via


sp_show_statistics (SQL Server Compact)

The stored procedure sp_show_statistics displays the current distribution statistics for the specified table and index, or for all tables and indexes.

Syntax

sp_show_statistics [ 'table_name' ] , [ 'index_name' ]

Arguments

  • table_name
    The name of the table for which you want to display statistics. If you do not specify a table name, the statistics for all tables and indexes in the database are returned.

  • index_name
    The name of the index on which you want statistics. If you do not specify an index name, all indexes in the specified table are returned.

Result Set

The following table describes the columns returned in the result set.

Column Name

Description

TABLE

The table that was specified.

INDEX

The index that was specified.

UPDATED

The date and time when the statistics were last updated.

ROWS

The number of rows in the table.

ROWS_SAMPLED

The number of rows that were used to calculate the statistics information.

STEPS

The number of distribution steps.

DENSITY

The selectivity of the first index column prefix.

AVERAGE_KEY_LENGTH

The average length of all index columns.

RECOMPUTE

A Boolean value. True indicates that this statistic will be automatically updated the next time it is used, if it is determined to be stale.

STALE

A Boolean value. True indicates that the query optimizer has determined that this statistic must be updated. If RECOMPUTE is true, this statistic will be automatically recomputed the next time that the query processor uses this statistic.

Remarks

The results returned indicate the selectivity of an index. A lower density indicates greater selectivity. The results provide the basis for determining whether an index is useful to the query optimizer.

Example

The following example displays statistics information for all indexes on the Address table.

sp_show_statistics 'Employees'

See Also

Reference

sp_show_statistics_columns (SQL Server Compact)

sp_show_statistics_steps (SQL Server Compact)

Other Resources

Enhancing Performance (SQL Server Compact)