- the number of records in the table
- the estimated number of distinct non-null values
- the number of null values
- the minimum and maximum values
- the most common values, with their frequencies
sql.cost_based_optimization setting in the
system configuration. To plan an
individual query without using statistics, use the KI_HINT_NO_STATS
hint.
The collected statistics can be viewed in the
ki_statistics catalog table. Statistics are not updated as the
table changes; collect them again after significant changes to the table’s
data. If the column’s statistics were collected after the table was last
modified, the existing statistics are kept and no new collection is done.
Statistics are removed when the table is dropped, or with
DROP STATISTICS.
The database can also collect statistics automatically, in the background, for
the columns that the cost-based optimizer finds to be missing statistics; see
the sql.automatic_stats settings in the
system configuration.
Collecting statistics requires read
permission on the entire
table; a user whose access to the table is limited to certain
rows or
columns cannot collect
statistics on it.
COLLECT STATISTICS Syntax
Parameters
<schema name>
<schema name>
Name of the schema containing the table on which to collect statistics
<table name>
<table name>
Name of the table on which to collect statistics
<column name>
<column name>
Name of the column on which to collect statistics; only one column can be given per statement
Examples
To collect statistics on a column of a table:COLLECT STATISTICS Example
View Statistics Example