optimizer_dynamic_sampling

本文探讨了Oracle数据库中成本基于优化器(CBO)在处理同表中相关联的两个列时可能出现的问题,并介绍了如何通过调整dynamic_sampling参数或使用dynamic_sampling hint来改进CBO的准确性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

看到这样一段话:
Correlation between columns in the same table always causes problems if those columns appear together in your where clause; the issue is not restricted to indexes. Sometimes you will be able to work around the problem by using the optimizer_dynamic_sampling parameter, or the dynamic_sampling hint (both of which appeared at some stage in 9i) to instruct Oracle to take a run-time sample of 32 or more blocks fromcritical tables to see what fraction of the rows matches your where clause.

同表中相关联的2个列,也会导致CBO计算错误,所以要使用dynamic_sampling这个参数,下面转一篇介绍这个参数的文章



dynamic_sampling也可作为一个hint:

select
/*+ index(t1) dynamic_sampling(t1 1) */
small_vc
from
t1
where
ind_pad = rpad('x',40)
and n1 = 2
and n2 = 2
;

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

转载于:http://blog.itpub.net/11517198/viewspace-609280/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值