update table statistics updates statistics that are stored in systabstats table, such as rowcount, cluster ratios, and so on. update table statistics does not affect column statistics stored in sysstatistics.
update table statistics table_name [partition data_partition_name] [index_name [partition index_partition_name]]
is the name of the table you are updating the statistics for.
is the name of the data partition for which you are updating the statistics for. If you do not include this, table statistics for all the the data partitions are updated.
is the name of index associated with the partition.
is the name of the index partition.
Performs a table statistics update on the smallsales partition:
update table statistics titles partition smallsales
Performs a table statistics update on all of the partitions in the titles table:
update table statistics titles
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_name – update table statistics updates statistics for all the index partitions of the index.
index_partition – update table statistics updates statistics for the specific index partition.
ANSI SQL – Compliance level: Transact-SQL extension.
update table statistics permission defaults to the table owner and is not transferable. The command can also be executed by the Database Owner, who can impersonate the table owner by running the setuser command.
Commands update all statistics, update index statistics, update statistics