Oracle cursor_shring,histograms,sql explain

今天在看一本书,看到这么一句话,醍醐灌顶啊,记录之
The problem related to the value force is that a single child cursor is used for all SQL statements sharing the same text after the replacement of the literals. Consequently, the literals (that are essential for taking advantage of histograms) are peeked only during the generation of the execution plan related to the first submitted SQL statement. Naturally, this could lead to suboptimal execution plans because literals used in subsequent SQL statements will lead to different execution plans. To avoid this problem, the value similar is available. In fact, it checks whether a histogram exists for one of the replaced literals, before reusing a cursor that is already available. If it does exist, a new child cursor is created. If it does not exist, an already available child cursor will be used.
In summary, if an application uses literals and cursor sharing is set to similar, the behavior depends on the existence of relevant histograms. If they do exist, similar behaves like exact. If they don’t exist, similar behaves like force. This means that if you are facing parsing problems, more often than not, it is pointless to use similar.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值