sp_show_statistics (SQL Server Compact Edition)

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


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


  • 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


The table that was specified.


The index that was specified.


The date and time when the statistics were last updated.


The number of rows in the table.


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


The number of distribution steps.


The selectivity of the first index column prefix.


The average length of all index columns.


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.


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.


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.


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

sp_show_statistics 'Address'

See Also


sp_show_statistics_columns (SQL Server Compact Edition)
sp_show_statistics_steps (SQL Server Compact Edition)

Other Resources

Enhancing Performance (SQL Server Compact Edition)

Help and Information

Getting SQL Server Compact Edition Assistance