-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: variable tidb_opt_enable_hash_join
to skip hash join
#46575
planner: variable tidb_opt_enable_hash_join
to skip hash join
#46575
Conversation
Welcome @coderplay! |
Hi @coderplay. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @coderplay. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/review default |
Potential Problems and SuggestionsProblem 1In the PR description, there is a placeholder Suggestion: Replace Problem 2There are no tests to check if setting the global variable Suggestion: Add a test case to verify that setting the global variable Problem 3There is no documentation update for the newly added global/session variable Suggestion: Update the documentation to include the new global/session variable Problem 4In the PR description, the release note is set to Suggestion: Update the release note to:
Overall, the PR looks good. Just a few minor issues and suggestions to make it even better. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@coderplay: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
@coderplay: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
"Warning": null | ||
}, | ||
{ | ||
"SQL": "select /*+ leading(t4, t3, t2, t1) */ * from t1, t2, t3, t4", |
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.
Why hashjoin can't be disabled in this case?
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.
I'll take a look at this.
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.
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.
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.
And do we need to pick this PR to v7.1? @coderplay @songrijie |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #46575 +/- ##
================================================
- Coverage 72.9961% 72.8785% -0.1177%
================================================
Files 1338 1367 +29
Lines 399462 409380 +9918
================================================
+ Hits 291592 298350 +6758
- Misses 89019 92174 +3155
- Partials 18851 18856 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest-required |
/retest-required |
planner/core/optimizer.go
Outdated
@@ -162,6 +162,7 @@ type logicalOptRule interface { | |||
func BuildLogicalPlanForTest(ctx context.Context, sctx sessionctx.Context, node ast.Node, infoSchema infoschema.InfoSchema) (Plan, types.NameSlice, error) { | |||
sctx.GetSessionVars().PlanID.Store(0) | |||
sctx.GetSessionVars().PlanColumnID.Store(0) | |||
sctx.GetSessionVars().EnableHashJoin = true |
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.
Too many CI failures due to the default value of this variable:
Can we change the name of the variable from EnableHashJoin
to DisableHashJoin
and set it as false
by default?
- for most users,
HashJoin
should be allowed, so usingfalse
as the default value seems safer. - for some tests, the test framework won't use
DefEnableHashJoin
to initializesctx.EnableHashJoin
, instead it uses the default value ofBool
inGolang
, which is false; If we useEnableHashJoin
, there will be plenty of test failures, changing it toDisableHashJoin
can fix this.
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.
After discussing with PM, we decided to keep it unchanged as EnableHashJoin
.
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.
Too many CI failures... For safety, how about using another solution, which is using DisableHashJoin
internally, and exposing enable_hash_join
to users.
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.
Too many CI failures... For safety, how about using another solution, which is using
DisableHashJoin
internally, and exposingenable_hash_join
to users.
@coderplay I've pushed some code to your PR directly (tomorrow is the code freeze deadline of v7.4 ...) by using this approach to solve CI failures.
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.
Thanks for fixing those @qw4990 ! In the future, how can I detect those issues locally before submitting this PR?
/retest-required |
@easonn7 PTAL |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: easonn7, qw4990, time-and-fate The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
This PR adds a global/session knob to disable hash join, in order to prevent query plan regression.
Use cases:
set tidb_opt_enable_hash_join=no
.set global tidb_opt_enable_hash_join=off
Issue Number: close #46695
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.