首页 > 代码库 > 直方图及low_value、high_value

直方图及low_value、high_value

直方图 Histogram是一种特殊的列统计信息,详细描述了目标列的数据分布情况。存储在数据字典基表 histogram$;

专门为了准确评估分布不均匀的目标列的可选择率、结果集的cardianlity。

详细描述了目标列的数据分布情况,并将分布情况记录在数据字典里。

 

select t1.column_name name,t1.num_distinct "#dst",t1.low_value,t1.high_value,
t1.density dens,t1.num_nulls "#null",t1.avg_col_len avglen,t1.HISTOGRAM,t1.num_buckets "#bkt"    
from user_tab_col_statistics t1
where t1.table_name=‘T‘;

NAME                                 #dst LOW_VALUE                                                        HIGH_VALUE                                                             DENS      #null     AVGLEN HISTOGRAM             #bkt
------------------------------ ---------- ---------------------------------------------------------------- ---------------------------------------------------------------- ---------- ---------- ---------- --------------- ----------
ID                                   1000 C102                                                             C20B                                                                   .001          0          4 NONE                     1
VAL1                                  457 C105                                                             C22160                                                           .002353264        481          3 HEIGHT BALANCED        254
VAL2                                    6 C20202                                                           C20207                                                                .0005          0          4 FREQUENCY                6
VAL3                                    6 C20202                                                           C20207                                                                .0005          0          4 FREQUENCY                6
PAD                                  1000 203F2C5D523371586E695D456775533C565A522A4F3128234F43502F77353026 7E7E7438735D7A464E77205B7B79454D517E384069784521344735457E2F2120       .001          0        251 HEIGHT BALANCED        254


select utl_raw.cast_to_number(low_value) as low_value,
utl_raw.cast_to_number(high_value) as high_value
from user_tab_col_statistics
where table_name=‘T‘
and column_name=‘VAL1‘;


/*
LOW_VALUE HIGH_VALUE
---------- ----------
         4       3295
*/

直方图及low_value、high_value