-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner: Exists subquery to join variable #63416
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
|
Hi @terry1purcell. 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-sigs/prow repository. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #63416 +/- ##
================================================
+ Coverage 72.7831% 73.2548% +0.4717%
================================================
Files 1835 1835
Lines 496868 497013 +145
================================================
+ Hits 361636 364086 +2450
+ Misses 113266 111055 -2211
+ Partials 21966 21872 -94
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR introduces a new global/session variable tidb_opt_enable_semi_join_rewrite to control the automatic rewriting of EXISTS correlated subqueries to inner joins with aggregation, similar to what the SEMI_JOIN_REWRITE() hint already provides.
- Adds session variable
tidb_opt_enable_semi_join_rewriteto enable semi-join rewrite optimization without requiring the hint - Updates semi-join cardinality estimation logic to improve accuracy for semi-join operations
- Modifies plan generation and binding logic to support the new variable
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/sessionctx/vardef/tidb_vars.go | Defines the new variable constant and default value |
| pkg/sessionctx/variable/sysvar.go | Registers the new system variable with session setter |
| pkg/sessionctx/variable/session.go | Adds EnableSemiJoinRewrite field to SessionVars struct |
| pkg/planner/core/rule_semi_join_rewrite.go | Updates rewrite logic to check both hint and session variable |
| pkg/planner/core/logical_plan_builder.go | Enables semi-join rewrite when session variable is set |
| pkg/planner/core/operator/logicalop/logical_join.go | Improves semi-join cardinality estimation algorithm |
| pkg/planner/core/expression_rewriter.go | Adds comment about variable usage in semi-join context |
| pkg/bindinfo/ | Updates binding plan generation to handle new variable |
| tests/integrationtest/r/planner/core/casetest/physicalplantest/physical_plan.result | Updated test expectations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
[LGTM Timeline notifier]Timeline:
|
|
/ok-to-test |
|
/retest-required |
|
/retest |
1 similar comment
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, qw4990, yudongusa 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 |
|
/retest |
1 similar comment
|
/retest |
|
/cherry-pick release-8.5 |
Signed-off-by: ti-chi-bot <[email protected]>
|
@terry1purcell: new pull request created to branch 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 ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: ref #44850
Problem Summary:
What changed and how does it work?
Create global/session variable tidb_opt_enable_semi_join_rewrite to allow users to control semi join rewrite of EXISTS correlated subqueries without needing the hint.
Check List
Tests
To test before change, and with hint:
Test with new variable:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.