Skip to content
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) #47277

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #46575

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:

  • As an application developer, I’m very confident the queries don’t benefit from hash join. However, at times, bad plans were generated in which a hash join was selected. I will config the connection pool, and initialize the connections with set tidb_opt_enable_hash_join=no.
  • As a DBA, I’m aware the application is OLTP workload, which works properly in MySQL ~5.7. I’m very sure the SQLs don’t need hash join. I’ve seen cases in the past. bad plans were generated in which a hash join was selected. After confirming with application developers, I will disable hash join in cluster level with set global tidb_opt_enable_hash_join=off

Issue Number: close #46695

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Add a new global/session variable `tidb_opt_enable_hash_join` to control whether hash join is enabled or not.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot requested a review from a team as a code owner September 26, 2023 02:25
@ti-chi-bot ti-chi-bot added ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. labels Sep 26, 2023
@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 26, 2023
@qw4990 qw4990 added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Sep 28, 2023
@qw4990
Copy link
Contributor

qw4990 commented Oct 8, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Oct 8, 2023

@qw4990: No presubmit jobs available for pingcap/tidb@release-7.1

In response to this:

/test unit-test

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.

@qw4990
Copy link
Contributor

qw4990 commented Oct 8, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Oct 8, 2023

@qw4990: No presubmit jobs available for pingcap/tidb@release-7.1

In response to this:

/test unit-test

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.

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

❗ No coverage uploaded for pull request base (release-7.1@9f089b3). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.1     #47277   +/-   ##
================================================
  Coverage               ?   73.4566%           
================================================
  Files                  ?       1203           
  Lines                  ?     376821           
  Branches               ?          0           
================================================
  Hits                   ?     276800           
  Misses                 ?      82365           
  Partials               ?      17656           

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 8, 2023
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 8, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 8, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-08 08:39:17.826528812 +0000 UTC m=+955155.413638952: ☑️ agreed by winoros.
  • 2023-10-08 08:43:35.114780639 +0000 UTC m=+955412.701890795: ☑️ agreed by time-and-fate.

@easonn7
Copy link

easonn7 commented Oct 8, 2023

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, time-and-fate, winoros, XuHuaiyu

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:
  • OWNERS [XuHuaiyu,time-and-fate,winoros]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Oct 8, 2023
@ti-chi-bot ti-chi-bot bot merged commit d121f46 into pingcap:release-7.1 Oct 8, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. epic/hint lgtm ok-to-test Indicates a PR is ready to be tested. priority/release-blocker This issue blocks a release. Please solve it ASAP. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants