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: add a fix control to allow generate index merge path when normal index lookup path exists #52872

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

time-and-fate
Copy link
Member

@time-and-fate time-and-fate commented Apr 24, 2024

What problem does this PR solve?

Issue Number: close #52869

What changed and how does it work?

Simple change. Please see the issue and code.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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.

如果查询有除了全表扫描以外的单索引扫描方式可以选择,优化器不会自动选择索引合并。现在可以通过 Optimizer Fix Controls 机制解除这个限制。
If the optimizer can choose the single index scan method (other than full table scan) for a query plan, the optimizer will not automatically use index merge. Now this limitation can be disabled by using the Optimizer Fix Controls.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 24, 2024
@time-and-fate time-and-fate added needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. and removed sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 24, 2024
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.6878%. Comparing base (10971ea) to head (a3af6a0).
Report is 2 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #52872         +/-   ##
=================================================
- Coverage   74.3919%   55.6878%   -18.7042%     
=================================================
  Files          1482       1593        +111     
  Lines        355545     598150     +242605     
=================================================
+ Hits         264497     333097      +68600     
- Misses        71785     241987     +170202     
- Partials      19263      23066       +3803     
Flag Coverage Δ
integration 37.1361% <100.0000%> (?)
unit 71.2164% <100.0000%> (-1.9306%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 49.8794% <ø> (+7.1317%) ⬆️

@ti-chi-bot ti-chi-bot bot added the sig/planner SIG: Planner label Apr 24, 2024
@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 24, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 25, 2024
drop table if exists t;
create table t(pk varbinary(255) primary key, a int, b varchar(50), c int, d varchar(45), index ia(a), index ib(b), index ic(c), index id(d));
EXPLAIN format = brief SELECT /*+ use_index_merge(t) */ * FROM t WHERE a = 1 AND (b = '2' OR c = 3 OR d = '4');
EXPLAIN format = brief SELECT * FROM t WHERE a = 1 AND (b = '2' OR c = 3 OR d = '4');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more test cases like:
b = '2' OR c = 3 OR b = '3' OR c = 4

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated~

@time-and-fate
Copy link
Member Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2024
Copy link

ti-chi-bot bot commented Apr 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, winoros

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 26, 2024
Copy link

ti-chi-bot bot commented Apr 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-25 18:02:53.0045883 +0000 UTC m=+283329.744491212: ☑️ agreed by winoros.
  • 2024-04-26 07:51:24.307196191 +0000 UTC m=+333041.047099098: ☑️ agreed by AilinKid.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 26, 2024
@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/unhold

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 26, 2024
@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/retest

2 similar comments
@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit e0b6b0c into pingcap:master Apr 26, 2024
22 of 23 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #52931.

ti-chi-bot bot pushed a commit that referenced this pull request Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. 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.
Projects
None yet
5 participants