create_extended_stats的创建及 cardinality opt_estimate相互影响-CSDN博客https://blog.csdn.net/jnrjian/article/details/142438401?sharetype=blogdetail&sharerId=142438401&sharerefer=PC&sharesource=jnrjian&spm=1011.2480.3001.8118
OPT_ESTIMATE cardinality 这两个都可以控制执行计划,不是说OPT_ESTIMATE 只能在估计的结果集上进行操作,这个操作的结果也可以返回来影响执行计划。
GOAL
Goal of the document is to show how an optimizer hint can be used in a SQL statement to specify the cardinality (no.of rows) for a join operation.
Generally, CARDINALITY hint is used to specify the no.of rows for a table and not for join.
SOLUTION
OPT_ESTIMATE hint can be used to specify the cardinality (no.of rows) for the join operations as well.
Syntax:
OPT_ESTIMATE(join, (alias1,alias2), rows=n) => To specify the no.of rows for join operation
OPT_ESTIMATE(join, (alias1,alias2), scale_rows=n) => To increase or decrease (scale up/down) the n