Drops statistics for multiple collections within the specified tables (in the current database).
DROP STATISTICS table.statistics_name [,...n]
Be careful when dropping statistics because dropping statistics may affect the plan chosen by the optimizer.
For information about displaying statistics, see DBCC SHOW_STATISTICS. For information about updating statistics, see UPDATE STATISTICS and the auto update statistics option of sp_dboption. For information about creating statistics, see CREATE STATISTICS, CREATE INDEX, and the auto create statistics option of sp_dboption.
DROP STATISTICS permission defaults to the table owner, and is not transferable. However, members of the db_owner fixed database role or sysadmin fixed server role can drop any object by specifying the owner in DROP STATISTICS.
This example drops the anames statistics group (collection) of the authors table and the tnames statistics (collection) of the titles table.
-- Create the statistics groups.
CREATE STATISTICS anames
ON authors (au_lname, au_fname)
WITH SAMPLE 50 PERCENT
GO
CREATE STATISTICS tnames
ON titles (title_id)
WITH FULLSCAN
GO
DROP STATISTICS authors.anames, titles.tnames
GO
CREATE INDEX | sp_createstats |
CREATE STATISTICS | sp_dboption |
DBCC SHOW_STATISTICS | UPDATE STATISTICS |
sp_autostats | USE |