-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Feat](Nereids) support use cbo rule hint #35925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
TPC-H: Total hot run time: 42090 ms |
TPC-DS: Total hot run time: 175056 ms |
ClickBench: Total hot run time: 30.65 s |
|
run buildall |
02b9444 to
b6f4ede
Compare
|
run buildall |
TPC-H: Total hot run time: 41074 ms |
TPC-DS: Total hot run time: 174333 ms |
ClickBench: Total hot run time: 31.5 s |
b6f4ede to
c2f1a44
Compare
|
run buildall |
TPC-H: Total hot run time: 41667 ms |
TPC-DS: Total hot run time: 171140 ms |
ClickBench: Total hot run time: 30.8 s |
c2f1a44 to
e826419
Compare
|
run buildall |
TPC-H: Total hot run time: 39991 ms |
TPC-DS: Total hot run time: 171195 ms |
ClickBench: Total hot run time: 31.07 s |
|
run buildall |
TPC-H: Total hot run time: 40942 ms |
TPC-DS: Total hot run time: 173023 ms |
ClickBench: Total hot run time: 31.03 s |
|
|
||
| private static final Logger LOG = LogManager.getLogger(CostBasedRewriteJob.class); | ||
|
|
||
| private static final ImmutableList<Pair<RuleType, String>> RuleHintName = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this name mapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
e826419 to
a89e21f
Compare
|
run buildall |
TPC-H: Total hot run time: 39795 ms |
TPC-DS: Total hot run time: 172650 ms |
ClickBench: Total hot run time: 31.1 s |
|
run buildall |
TPC-H: Total hot run time: 39851 ms |
TPC-DS: Total hot run time: 172985 ms |
ClickBench: Total hot run time: 30.81 s |
|
run buildall |
TPC-H: Total hot run time: 39383 ms |
TPC-DS: Total hot run time: 173499 ms |
ClickBench: Total hot run time: 30.75 s |
|
PR approved by at least one committer and no changes requested. |
Add feat of force use/nouse cbo rule hint introduce when not using this hint, cbo rules like INFER_SET_OPERATOR_DISTINCT would generate two plans and compare their cost and nereids optimizer would decide which is better. But when we want to control the behavior of cbo rules we could use this force cbo rule hint usage example explain shape plan select /*+ USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; the USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) hint would force rule INFER_SET_OPERATOR_DISTINCT to be used and generate plan like, which hashAgg below union is generated by this rule: -- !with_hint_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t1] --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t2] Hint log: Used: INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: When we want to force disable this rule, we could use explain shape plan select /*+ NO_USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; which would generate plan with this rule: -- !with_hint_no_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------PhysicalOlapScan[t1] --------------PhysicalOlapScan[t2] Hint log: Used: NO_INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: change sessionvariable enableNereidsRules to varType.remove
Add feat of force use/nouse cbo rule hint introduce when not using this hint, cbo rules like INFER_SET_OPERATOR_DISTINCT would generate two plans and compare their cost and nereids optimizer would decide which is better. But when we want to control the behavior of cbo rules we could use this force cbo rule hint usage example explain shape plan select /*+ USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; the USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) hint would force rule INFER_SET_OPERATOR_DISTINCT to be used and generate plan like, which hashAgg below union is generated by this rule: -- !with_hint_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t1] --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t2] Hint log: Used: INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: When we want to force disable this rule, we could use explain shape plan select /*+ NO_USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; which would generate plan with this rule: -- !with_hint_no_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------PhysicalOlapScan[t1] --------------PhysicalOlapScan[t2] Hint log: Used: NO_INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: change sessionvariable enableNereidsRules to varType.remove
…pache#39715) use_cbo_rule_hint show used but it does not be used intro by: apache#35925
…#41869) pick: #35925 #39715 #40167 #40958 Add feat of force use/nouse cbo rule hint and fix pr introduce when not using this hint, cbo rules like INFER_SET_OPERATOR_DISTINCT would generate two plans and compare their cost and nereids optimizer would decide which is better. But when we want to control the behavior of cbo rules we could use this force cbo rule hint usage example explain shape plan select /*+ USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; the USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) hint would force rule INFER_SET_OPERATOR_DISTINCT to be used and generate plan like, which hashAgg below union is generated by this rule: -- !with_hint_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t1] --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t2] Hint log: Used: INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: When we want to force disable this rule, we could use explain shape plan select /*+ NO_USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; which would generate plan with this rule: -- !with_hint_no_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------PhysicalOlapScan[t1] --------------PhysicalOlapScan[t2] Hint log: Used: NO_INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: change sessionvariable enableNereidsRules to varType.remove
Add feat of force use/nouse cbo rule hint
when not using this hint, cbo rules like INFER_SET_OPERATOR_DISTINCT would generate two plans and compare their cost
and nereids optimizer would decide which is better. But when we want to control the behavior of cbo rules we could use this force cbo rule hint
the USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) hint would force rule INFER_SET_OPERATOR_DISTINCT to be used
and generate plan like, which hashAgg below union is generated by this rule:
When we want to force disable this rule, we could use
which would generate plan with this rule: