delete statistics

Description

Removes statistics from the sysstatistics system table.

Syntax

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

Parameters

shared

removes simulated statistics information from sysstatistics in the master database.

table_name

removes statistics for all columns in the table.

data_partition_name

deletes all statistics for the data partition. Global statistics are not deleted.

column_name

removes statistics for the specified column.

Examples

Example 1

Deletes the densities, selectivities, and histograms for all columns in the titles table:

delete statistics titles

Example 2

Deletes densities, selectivities, and histograms for the pub_id column in the titles table:

delete statistics titles (pub_id)

Example 3

Deletes densities, selectivities, and histograms for the smallsales partition of the titles table:

delete statistics titles partition smallsales

Example 4

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)

Example 5

Deletes densities, selectivities, and histograms for the column pub_id and for the data partition smallsales:

delete statistics titles partition smallsales (pub_id)

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Permission to use delete statistics can be granted or transferred to anyone by table owner or system administrator.

See also

Commands create index, grant, revoke, update

Utilities optdiag