Oracle 12c新特性 - Hybrid histogram 1

1.  创建一个表test_tmp3

CODE COUNT(1)
------  --------
1    2
2    2
3    100
4    20
5    1
6    54
7    2
8    2
9    5
10   1
11   2
12   1

注:  数据共 192 行


2.  生成 Hybrid Histogram 的必要条件: 

1).  n is less than the NDV, where n is the user-specified number of buckets. If no number is specified, then n defaults to 254.
2).  The criteria for top frequency histograms do not apply. See "Criteria For Frequency Histograms."
3).  The sampling percentage is AUTO_SAMPLE_SIZE.

If users specify their own percentage, then the database creates frequency or height-balanced histograms.


由算术公式可以计算出,什么情况下在1,3条件满足时不会生成 top frequency histogram ,会生成 Hybrid Histogram .

1 - 1/n > 187/192    (187 是表在bucket =8的情况下 个数排在前八位[top 8]的所有值的个数,这个公式反过来是  top frequency histogram生成的条件,详见 http://blog.itpub.net/35489/viewspace-1128170/ ) 
n < 12                (12是不同值个数)

发现n没有解,看来这样的列(CODE)只能生成 top frequency histogram 。 从公式可以看出,想要生成hybrid histogram,  n 要尽量大,且数据总行数尽量大,而要n

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-1128177/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/35489/viewspace-1128177/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值