From Oracle 10g, the Oracle SMON (System Monitor) process regularly gathers information on columns that are used in query predicates and updates them automatically into a table named COL_USAGE$ in the SYS schema. Unlike the MON_MOD$ table, also in the SYS schema, which records table-level DML activity such as the number of rows changed by INSERT, DELETE, and UPDATE operations, and exposes them via the DBA_TAB_MODIFICATIONS view, the COL_USAGE$ view is neither documented nor wrapped by a legible view. The column names, however, are very revealing; these are detailed in
Col_usage$ description Column Name Description OBJ# Object number. Corresponds directly to the OBJ# column in the SYS.OBJ$ table. You can use this to determine the name of the table containing that column. INTCOL# Column number. Corresponds directly to the COL# column in the SYS.COL$ table. You can use this to determine the name of the column involved. EQUALITY_PREDS Number of times this column uses an equality predicate of the form table.column = constant. EQUIJOIN_PREDS Number of times this column was used in an equijoin using a predicate of the form table1.column1 = table2.column2. NONEQUIJOIN_PREDS Number of times this column was used in an nonequijoin using a predicate of the form table1.column1 != table2.column2. RANGE_PREDS Number of times this column was used as a predicate of the form table1.column1 BETWEEN constant1 AND constant2. LIKE_PREDS Number of times this column was used as a predicate of the form table1.column1 LIKE like_constant. NULL_PREDS Number of times this column was used as a predicate of the form table1.column1 IS NULL. TIMESTAMP The timestamp when the column was last recorded as having been used as a predicate in any query. This is updated by SMON once every 15 minutes.
Using the values in this table, you can determine whether additional indexes and histograms can be created on these columns based on how the columns are referred and by what type of predicates.
For example if that column is involved more in range predicates a histograms creation may helpful and also for a equijoin predicates.
As usual, there are some caveats. Be aware that SMON obtains this information by scanning the library cache in the shared pool and updating this table once every 15 minutes or so. In an active database with memory pressure on the shared pool, this information may be lost. This information may also be lost when the database is shut down unless you invoke the DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO procedure beforehand.
-Thanks
Geek DBA
This stands true for both HEIGHT BALANCED & FREQUENCY histograms?
YOSELYN
Hi, i have reading out and i will definitely bookmarrk your site, just wanted to say i liked this article.