update table statistics

Updates statistics that are stored in systabstats table, such as rowcount, cluster ratios, and so on. Does not affect column statistics stored in sysstatistics.

Syntax

 update table statistics table_name
	[partition data_partition_name]
	[index_name [partition index_partition_name]]

Parameters

Examples

Usage

  • update table statistics does not update statistics for index partitions. To generate table-level statistics for index partitions, use update statistics.

  • Because running update table statistics incurs the I/O cost of running update statistics, use update statistics to generate both column and table statistics.

    You can create, and then drop, a global index to generate global statistics.

    When you run update statistics on a single partition, you create global statistics by merging partition statistics. However, these merged global statistics are less accurate than the global statistics created as a side-effect of global index creation. Avoid generating column statistics that overwrite more accurate, earlier versions of column statistics.

    When you specify:
    • index_nameupdate table statistics updates statistics for all the index partitions of the index.

    • index_partitionupdate table statistics updates statistics for the specific index partition.

See also Performance and Tuning Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

You must be the table owner or a user with update statistics permission on the table to run update table statistics.

Related reference
update all statistics
update index statistics
update statistics