UPDATE STATISTICS (SQL Server Compact Edition)

Updates the statistics for the supplied table and index or indexes.

Syntax

UPDATE STATISTICS ON < table_name > [ . <index_name> ]
    WITH FULLSCAN {, NORECOMPUTE }

Arguments

  • table_name
    Specifies the name of the table on which to update the statistics.
  • index_name
    The index on which to update the statistics. If an index is not specified, all distribution statistics in the specified table or indexed view are updated. This includes statistics that are created by using the CREATE STATISTICS statement, statistics that are created automatically, and statistics that are created during index creation.
  • FULLSCAN
    Specifies that all rows in the table should be read to gather the statistics.
  • NORECOMPUTE
    Specifies that automatic recomputation of the statistics should be disabled. If this option is specified, the Database Engine continues to use old statistics even as the data changes. The statistics are not automatically updated and maintained by the database engine, which might produce suboptimal plans.

    Note

    It is recommended that this option be used rarely and only by a trained system administrator.

Example

This example updates the Product index on the Production table, forces a full scan of all rows in the Production table, and turns off automatic statistics updating.

UPDATE STATISTICS ON Production.Product
   WITH FULLSCAN, NORECOMPUTE

Change History

Release History

5 December 2005

Changed content
  • Updated the description for index_name