Histograms are kept on a per-column basis, rather than on a per-index basis. This has certain implications for managing statistics:
If a column appears in more than one index, update statistics, update index statistics or create index updates the histogram for the column and the density statistics for all prefix subsets.
update all statistics updates histograms for all columns in a table.
Dropping an index does not drop the statistics for the index, since the optimizer can use column-level statistics to estimate costs, even when no index exists.
If you want to remove the statistics after dropping an index, you must explicitly delete them with delete statistics.
If the statistics are useful to the optimizer and you want to keep the statistics without having an index, you need to use update statistics, specifying the column name, for indexes where the distribution of key values changes over time.
Truncating a table does not delete the column-level statistics in sysstatistics. In many cases, tables are truncated and the same data is reloaded.
Since truncate table does not delete the column-level statistics, there is no need to run update statistics after the table is reloaded, if the data is the same.
If you reload the table with data that has a different distribution of key values, you need to run update statistics.
You can drop and re-create indexes without affecting the index statistics, by specifying 0 for the number of steps in the with statistics clause to create index. This create index command does not affect the statistics in sysstatistics:
create index title_id_ix on titles(title_id) with statistics using 0 values
This allows you to re-create an index without overwriting statistics that have been edited with optdiag.
If two users attempt to create an index on the same table, with the same columns, at the same time, one of the commands may fail due to an attempt to enter a duplicate key value in sysstatistics.