update statistics

Updates information about the distribution of key values in specified indexes, for all columns in an index, table, or partition, and resets the data change counters for global nonclustered indexes.

Syntax

update statistics table_name
	[[partition data_partition_name] 
		[ (column1, column2, …) | (column1), (column2), …] |
	index_name [partition index_partition_name]] 
	[using step values | [out_of_range [on | off| default]]]
	[with consumers = consumers][, sampling=N percent]
		[, no_hashing | partial_hashing | hashing]
		[, max_resource_granularity = N [percent]] 
		[, histogram_tuning_factor = int ]
		[, print_progress = int]

Parameters

Examples

Usage

See also:
  • Performance and Tuning Guide

    For optdiag syntax and usage, see Statistics Tables and Displaying Statistics with optdiag in Performance and Tuning Series: Monitoring and Analyzing.

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 statistics.

Related reference
delete statistics
update all statistics
update index statistics
update table statistics