CREATE STATISTICS
defines statistics
What changes
- Input
- column data (sample or full scan)
- Output or change
- statistics object
Syntax at a glance
CREATE STATISTICS statistics_name ON { table_or_indexed_view_name } ( column [ , ...n ] ) [ WITH FULLSCAN ] ;
Work example
A query plan needs statistics on a column combination not covered by existing statistics.
Compare existing statistics, data distribution, and predicate order before adding a lab statistic.
Check your work The statistic covers the target columns and the plan uses it for the intended estimate.
Open Microsoft Learn for full syntax, permissions, and details for your version.