4. 生成top frequency histogram 的必要条件:
1). The data set has more than n distinct values. (n表示桶数量)
2). The percentage of rows occupied by the top n frequent values is equal to or greater than threshold p, where p is (1-(1/n))*100.
3). The estimate_percent parameter is set to AUTO_SAMPLE_SIZE in the DBMS_STATS statistics gathering procedure.
top n 在这里表示 top 8 的数据(查询出的前8行rows加总) :
select sum(CNT) from (
select code , count(1) as CNT from hw.test_tmp3 group by code order by count(1) desc
) where rownum<=8 ;
得出top 8 的value 总行数有187 , 占用百分比为: 187/192 = 0.9739
1-1/n = 1-1/8 = 0.875 < 0.9739
显然,满足第二个条件,其他1,3条件也是满足的,所以生成了top frequency histogram.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/35489/viewspace-1128170/ ,如需转载,请注明出处,否则将追究法律责任。