Oracle Database Cardinality Feedback

此功能自11gR2引入,旨在自动改进重复执行查询的计划。通过首次执行SQL语句并监测某些低质量估算,如缺乏统计数据的表或具有复杂谓词的表,如果实际执行过程中发现估算与实际值显著不同,则记录正确的估算值以供后续使用。

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

This blog is an extraction of https://blogs.oracle.com/optimizer/entry/cardinality_feedback

Introduced in 11gR2. The purpose of this feature is to automatically improve plans for queries that are executed repeatedly.During the first execution of a SQL statement, an execution plan is generated as usual. During optimization, certain types of estimates that are known to be of low quality (for example, estimates for tables which lack statistics or tables with complex predicates) are noted, and monitoring is enabled for the cursor that is produced. If cardinality feedback monitoring is enabled for a cursor, then at the end of execution, some of the cardinality estimates in the plan are compared to the actual cardinalities seen during execution. If some of these estimates are found to differ significantly from the actual cardinalities, the correct estimates are stored for later use. The next time the query is executed, it will be optimized again, and this time the optimizer uses the corrected estimates in place of its usual estimates.

Cardinality feedback is limited to portions of the plan whose estimates are not affected by bind variables. For instance, if a table has a filter comparing a column to a bind value, the cardinality of that table will not be used.  However, cardinality feedback can still be used for cardinalities elsewhere in the plan.


The monitoring for cardinality feedback is disabled after the first execution. In Oracle Database 11gR2, cardinality feedback monitors and feeds back the following kinds of cardinalities:
Single table cardinality (after filter predicates are applied)
Index cardinality (after index filters are applied)
Cardinality produced by a group by or distinct operator
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值