Retrieves the histogram for a column.
[, owner_name ]
col_name Use this CHAR(128) parameter to specify the column for which to retrieve the histogram.
tbl_name Use this CHAR(128) parameter to specify the table in which col_name is found.
owner_name Use this optional CHAR(128) parameter to specify the owner of tbl_name.
|Column name||Data type||Description|
|StepNumber||SMALLINT||Histogram bucket number. The frequency of the first bucket ( StepNumber = 0) indicates the selectivity of NULLs.|
|Low||CHAR(128)||Lowest (inclusive) column value in the bucket.|
|High||CHAR(128)||Highest (exclusive) column value in the bucket.|
|Frequency||DOUBLE||Selectivity of values in the bucket.|
This procedure, intended for internal diagnostic purposes, retrieves column statistics from the database server for the specified columns. Note that while these statistics are permanently stored in the system table ISYSCOLSTAT, they are maintained in memory while the server is running, and written to ISYSCOLSTAT periodically. As such, the statistics returned by the sa_get_histogram system procedure may differ from those obtained by selecting from ISYSCOLSTAT at any given point of time.
You can manually update ISYSCOLSTAT with the latest statistics held in memory using the sa_flush_statistics system procedure, however, this is not recommended in a production environment, and should be reserved for diagnostic purposes.
A singleton bucket is indicated by a Low value in the result set being equal to the corresponding High value.
It is recommended that you view histograms using the Histogram utility. See Histogram utility (dbhist).
To determine the selectivity of a predicate over a string column, you should use the ESTIMATE or ESTIMATE_SOURCE functions. For string columns, both sa_get_histogram and the Histogram utility retrieve nothing from the ISYSCOLSTAT system table. Attempting to retrieve string data generates an error.
DBA authority required