Oracle uses two types of histograms for column statistics: height-balanced histograms and frequency histograms.
The type of histogram is stored in the HISTOGRAM column of the *TAB_COL_STATISTICS views (USER and DBA). This column can have values of HEIGHT BALANCED, FREQUENCY, or NONE.
In a height-balanced histogram, the column values are divided into bands so that each band contains
approximately the same number of rows. The useful information that the histogram provides is where in
the range of values the endpoints fall.
In a frequency histogram, each value of the column corresponds to a single bucket of the histogram. Each bucket contains the number of occurrences of that single value. Frequency histograms are automatically created instead of height-balanced histograms when the number of distinct values is less than or equal to the number of histogram buckets specified. Frequency histograms can be viewed using the *TAB_HISTOGRAMS
views.
Data Dictionary Objects
DBA
ALL
USER
dba_histograms
all_histograms
user_histograms
dba_part_histograms
all_part_histograms
user_part_histograms
dba_subpart_histograms
all_sub_part_histograms
user_sub_part_histograms
dba_tab_histograms
all_tab_histograms
user_tab_histograms
Note: Histograms can be generated by two
different methods ... both involve the keyword "SIZE".
Generation With DBMS_STATS
dbms_stats.gather_table_stats(<schema_name>,
<table_name>,
METHOD_OPT => FOR COLUMN SIZE <integer> <column_name>
desc user_histograms
set linesize 121
col column_name format a30
col endpoint_actual_value format a20
drop table servers purge;
drop table serv_inst purge;