planner: fix index range intersection for in-list and other predicates #58029
Conversation
|
Hi @ghazalfamilyusa. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions 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. |
1798d42 to
8661177
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #58029 +/- ##
================================================
+ Coverage 73.1839% 73.9687% +0.7847%
================================================
Files 1671 1675 +4
Lines 460731 471156 +10425
================================================
+ Hits 337181 348508 +11327
+ Misses 102827 101849 -978
- Partials 20723 20799 +76
Flags with carried forward coverage won't be shown. Click here to find out more.
|
8661177 to
61274f3
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qw4990, winoros The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@ghazalfamilyusa: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #57694
Problem Summary:
This is a limitation for optimal multi-column index range derivation. It is similar to #54166 but different where point ranges are derived from IN list on the prefix column. A simple example is below where the range is based on "t1.a1 IN ( 44, 70, 76)" and not the full predicate "t1.a1 IN ( 44, 70, 76) AND (t1.a1 > 70 OR (t1.a1 = 70 AND t1.b1 > 41))"
The optimal solution is below where the range intersection of all predicates is: (70 41,70 +inf], [76,76]
We already have the logic of intersection through prior 54166 PR and it is computed for this case as well. The problem is that we do not choose the intersection for this case.
What changed and how does it work?
The fix is to recognize this case by comparing the conjunctive normal form, or CNF result (applying all predicates) and IN list ranges and pick the most selective. The CNF result is more selective if the covers a superset of filters. In the above example, the CNF result access conditions is "t1.a1 IN ( 44, 45) AND (t1.a1 > 70 OR (t1.a1 = 70 AND t1.b1 > 41))" which is a superset of the IN list access conditions "
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.