delete statistics

Removes statistics from the sysstatistics system table.

Syntax

delete [shared] statistics table_name
	[partition data_partition_name] 
	[(column_name[, column_name] ...)]

Parameters

Examples

Usage

  • 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.

    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, use the delete shared statistic command to drop the information in master..sysstatistics.

See also optdiag in the Utility Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for delete statistics differ based on your granular permissions settings.

SettingDescription
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.

Related reference
drop table
drop index
update statistics
create index
grant
revoke
update