SQL Flow Field Guide

UPDATE STATISTICS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

rebuilds histograms and density info

What changes

Input
table or indexed view column data (full scan or sample)
Output or change
statistics objects

Syntax at a glance

UPDATE STATISTICS table_or_indexed_view_name [ { { index_or_statistics__name } | ( { index_or_statistics_name } [ , ...n ] ) } ] [ WITH [ FULLSCAN [ [ , ] PERSIST_SAMPLE_PERCENT = { ON | OFF } ] | SAMPLE number { PERCENT | ROWS } [ [ , ] PERSIST_SAMPLE_PERCENT = { ON | OFF } ] | RESAMPLE [ ON PARTITIONS ( { <partition_number> | <range> } [ , ...n ] ) ] | <update_stats_stream_option> [ , ...n ] ] [ [ , ] [ ALL | ...

Work example

An incident review finds a stale statistic behind a poor row estimate.

Check the statistic age, sampled rows, data change, and query plan before scheduling a targeted refresh.

Check your work The refreshed histogram reflects current data and the query estimate moves toward observed rows.

Open Microsoft Learn for full syntax, permissions, and details for your version.