UPDATE_STATISTICS command in SQL


UPDATE_STATISTICS
updates the indexes on these tables accordingly. Basically this command is used when we have to do a large data process. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account. Or we can say that it updates information about the distribution of key values in specified indexes, for all columns in an index, table, or partition.

Syntax:


update
statistics table_name
[[ partition data_partition_name ] [ (column_list ) ]
|
index_name [ partition index_partition_name ] ]
[ using step values ]
[ with consumers = consumers ][, sampling=N percent ]