UPDATE STATISTICS

Update statistics for one or more table columns in the current database.

Syntax
      UPDATE STATISTICS {table | view}  { index |statistics } [,...n]
            [WITH option ] [,] [ALL | COLUMNS | INDEX] 
               [ [,]NORECOMPUTE] ];

   Options: 
           FULLSCAN 
           SAMPLE number {PERCENT | ROWS}
           RESAMPLE  
           STATS_STREAM = stats_stream ] [,]  

Key
   statistics     The name of the statistics group to create
   table/view     The item for which statistics should be created
   column         The column(s) on which to create statistics. (not xml column) 
   FULLSCAN       Read all rows in table.
   SAMPLE         Read a percentage, or a specified random number of rows.
   NORECOMPUTE    Do not automatically recompute statistics.

The statistics include a histogram and associated density groups (collections) over the column(s).

Examples

UPDATE STATISTICS MySchema.MyTable MyStats
WITH SAMPLE 30 PERCENT;

"There are lies, damned lies, and statistics” ~ Disraeli

Related commands

CREATE STATISTICS
DROP STATISTICS
DBCC SHOW_STATISTICS
Equivalent Oracle command: DBMS_STATS


 
Copyright © 1999-2024 SS64.com
Some rights reserved