Oracle 12c新特性 - Top frequency histogram 3

tolywang發表於2014-03-24

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部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-1128170/,如需轉載,請註明出處,否則將追究法律責任。

相關文章