Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » System Procedures » System procedures

sa_get_dtt system procedure Next Page

sa_get_histogram system procedure

Retrieves the histogram for a column.


[, owner_name ]

Result set
Column nameData typeDescription
StepNumberSMALLINTHistogram bucket number. The frequency of the first bucket ( StepNumber = 0) indicates the selectivity of NULLs.
LowCHAR(128)Lowest (inclusive) column value in the bucket.
HighCHAR(128)Highest (exclusive) column value in the bucket.
FrequencyDOUBLESelectivity 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

Side effects


See also