Removes statistics from the sysstatistics system table.
delete [shared] statistics table_name [(column_name [, column_name]...)]
removes simulated statistics information from sysstatistics in the master database.
removes statistics for all columns in the table.
removes statistics for the specified column.
Delete the densities, selectivities, and histograms for all columns in the titles table:
delete statistics titles
Deletes densities, selectivities, and histograms for the pub_id column in the titles table:
delete statistics titles(pub_id)
Deletes densities, selectivities, and histograms for pub_id, pubdate, without affecting statistics on the single-column pub_id or the single-column pubdate:
delete statistics titles(pub_id, pubdate)
delete statistics removes statistics for the specified columns or table from the sysstatistics table. It does not affect statistics in the systabstats table.
When you issue the drop table command, the corresponding rows in sysstatistics are dropped. When you use the drop index command, the rows in sysstatistics are not deleted. This allows the query optimizer to continue to use index statistics without incurring the overhead of maintaining the index on the table.
WARNING! Densities, selectivities, and histograms are essential to good query optimization. The delete statistics command is provided as a tool to remove statistics not used by the optimizer. If you inadvertently delete statistics needed for query optimization, run update statistics on the table, index, or column.
Loading simulated statistics with the optdiag utility command adds a small number of rows to master..sysstatistics table. If the simulated statistics are no longer in use, the information in master..sysstatistics can be dropped with the delete shared statistics command.
ANSI SQL – Compliance level: Transact-SQL extension.
Only the table owner or a System Administrator can use delete statistics.
Commands create index, update