Removes statistics from the sysstatistics system table.
delete [shared] statistics table_name [partition data_partition_name] [(column_name[, column_name] ...)]
delete statistics titles
delete statistics titles (pub_id)
delete statistics titles partition smallsales
delete statistics titles (pub_id, pubdate)
delete statistics titles partition smallsales (pub_id)
delete statistics does not affect statistics in the systabstats table.
delete statistics on a data partition does not delete global statistics.
When you issue the drop table command, the corresponding rows in sysstatistics are dropped. When you use drop index, 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.
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, use the delete shared statistic command to drop the information in master..sysstatistics.
See also optdiag in the Utility Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
The permission checks for delete statistics differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be the table owner, or a user with delete statistics permission. |
Disabled | With granular permissions disabled, you must be the table owner, a user with sa_role, or a user with delete statistics permission.. delete statistics permission an be granted or transferred to anyone by table owner or system administrator. |