UPDATE STATISTICS statement
Use the UPDATE STATISTICS statement to update system catalog information that the query optimizer uses for operations on objects in the local database. The UPDATE STATISTICS statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
column | A column in table or synonym | Must exist. With the MEDIUM or HIGH keyword, the column cannot be of BYTE, LVARCHAR, or TEXT data type. | Identifier |
owner | The owner of table or synonym | Must be the owner of table or synonym | Owner name |
synonym | A synonym for a table whose statistics are to be updated | The synonym and the table to which it points must exist in the current database | Identifier |
table | Table for which statistics are to be updated | Must exist in the current database or be a temporary table created in the current session | Identifier |
Usage
- Calculate the distribution of column values for tables and table fragments.
- Update system catalog tables that the database server uses to optimize queries.
- Force reoptimization of SPL routines.
- Convert existing indexes when you upgrade the database server.
Run the UPDATE STATISTICS statement in a transaction that does not contain any other statements.
UPDATE STATISTICS; -- calculates LOW column distribution statistics for -- all permanent user-defined and system catalog tables -- that the AUTO_STAT_MODE and STATCHANGE settings allow
For more examples of UPDATE STATISTICS statements that specify no identifiers of tables or of SPL routines, see the topic The scope of UPDATE STATISTICS statements. See also the references to AUTO_STAT_MODE and STATCHANGE topics in Performance considerations of UPDATE STATISTICS statements.
The UPDATE STATISTICS statement is not supported on secondary servers within a high-availability cluster.
Invalid default sbspace
name
".