-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: support OR list nested in AND list for mv index | tidb-test=pr/2309 #51716
planner: support OR list nested in AND list for mv index | tidb-test=pr/2309 #51716
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51716 +/- ##
=================================================
- Coverage 72.4655% 54.6408% -17.8248%
=================================================
Files 1476 1588 +112
Lines 364511 607934 +243423
=================================================
+ Hits 264145 332180 +68035
- Misses 80908 252695 +171787
- Partials 19458 23059 +3601
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
/retest |
IndexMerge_9 0.01 root type: union | ||
├─IndexRangeScan_5(Build) 10.00 cop[tikv] table:t2, index:idx(c, cast(`a` as signed array)) range:[1,1], keep order:false, stats:pseudo | ||
├─IndexRangeScan_6(Build) 0.10 cop[tikv] table:t2, index:idx2(cast(`b` as signed array), c) range:[2 3,2 3], keep order:false, stats:pseudo | ||
└─Selection_8(Probe) 0.01 cop[tikv] or(and(json_contains(planner__core__casetest__index__index.t2.a, cast("[1, 2, 3]", json BINARY)), and(eq(planner__core__casetest__index__index.t2.c, 1), eq(planner__core__casetest__index__index.t2.d, 2))), and(json_memberof(cast(2, json BINARY), planner__core__casetest__index__index.t2.b), and(eq(planner__core__casetest__index__index.t2.c, 3), eq(planner__core__casetest__index__index.t2.d, 2)))) | ||
└─TableRowIDScan_7 10.10 cop[tikv] table:t2 keep order:false, stats:pseudo | ||
IndexLookUp_11 8.00 root | ||
├─IndexRangeScan_8(Build) 10.00 cop[tikv] table:t2, index:idx3(c, d) range:[1 2,1 2], [3 2,3 2], keep order:false, stats:pseudo | ||
└─Selection_10(Probe) 8.00 cop[tikv] or(and(json_contains(planner__core__casetest__index__index.t2.a, cast("[1, 2, 3]", json BINARY)), and(eq(planner__core__casetest__index__index.t2.c, 1), eq(planner__core__casetest__index__index.t2.d, 2))), and(json_memberof(cast(2, json BINARY), planner__core__casetest__index__index.t2.b), and(eq(planner__core__casetest__index__index.t2.c, 3), eq(planner__core__casetest__index__index.t2.d, 2)))) | ||
└─TableRowIDScan_9 10.00 cop[tikv] table:t2 keep order:false, stats:pseudo |
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.
According to #50183, we should not generate a scan on a mv index if the access filter doesn't cover the mv column.
verifyPlanCacheForMVIndex(t, tk, true, false, | ||
verifyPlanCacheForMVIndex(t, tk, false, false, |
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.
Ditto.
Actually this test case uses exactly the same query.
/hold |
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.
Rest LGTM
if len(bestPaths) == 0 { | ||
return nil | ||
} |
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.
Please add one more test case for this branch, for example:
create table t (a int, b int, c int, d int, j json, key kb(b, (cast(j as unsigned array))), key(d, c));
explain select * from t where (c=1 or b=1) and (1 member of (j));
explain select * from t where (c=1 or b=1) and (1 member of (j)) and d=1;
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.
REST LGTM
/unhold |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, qw4990 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 |
What problem does this PR solve?
Issue Number: close #51778
What changed and how does it work?
Use new methods to replace the original implementation for DNF case in
generateIndexMergeOnDNF4MVIndex()
andgenerateIndexMerge4ComposedIndex()
.Please see comments for details.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.