tidb
tidb copied to clipboard
planner: use ordered index with is null predicate
What problem does this PR solve?
Issue Number: close #54188
Problem Summary: Properly classify columns with null predicates (e.g. WHERE a IS NULL) as constant so index selection can take advantage of that to satisfy a sort in
as constant so index selection can take advantage of that to satisfy a sort in:
tidb/pkg/planner/core/find_best_task.go
Dupe of #54253 with bazel fixes. @ari-e is out for a bit so attempting to unblock this while he is out.
What changed and how does it work?
Added checks for is null predicate during planning and fill corresponding data structures marking that column as a constant.
Check List
Tests
- [x] 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.
None
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign ailinkid for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Hi @michaelmdeng. Thanks for your PR.
I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
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/test-infra repository.
Hi @michaelmdeng. Thanks for your PR.
PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.
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.
/ok-to-test
@michaelmdeng: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| fast_test_tiprow | 9f7b467cfb46c6857a29d8c0f3eebe60279ac9e1 | link | true | /test fast_test_tiprow |
Full PR test history. Your PR dashboard.
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. I understand the commands that are listed here.
Codecov Report
Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.
Project coverage is 55.5885%. Comparing base (
432bb79) to head (9f7b467). Report is 91 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #54290 +/- ##
=================================================
- Coverage 72.9282% 55.5885% -17.3397%
=================================================
Files 1523 1650 +127
Lines 435564 617165 +181601
=================================================
+ Hits 317649 343073 +25424
- Misses 98420 250595 +152175
- Partials 19495 23497 +4002
| Flag | Coverage Δ | |
|---|---|---|
| integration | 22.9875% <86.3636%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.9656% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 52.7623% <ø> (+6.5937%) |
:arrow_up: |
@michaelmdeng: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| idc-jenkins-ci-tidb/mysql-test | 9f7b467cfb46c6857a29d8c0f3eebe60279ac9e1 | link | true | /test mysql-test |
| idc-jenkins-ci-tidb/check_dev | 9f7b467cfb46c6857a29d8c0f3eebe60279ac9e1 | link | true | /test check-dev |
| idc-jenkins-ci-tidb/unit-test | 9f7b467cfb46c6857a29d8c0f3eebe60279ac9e1 | link | true | /test unit-test |
| idc-jenkins-ci-tidb/check_dev_2 | 9f7b467cfb46c6857a29d8c0f3eebe60279ac9e1 | link | true | /test check-dev2 |
Full PR test history. Your PR dashboard.
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. I understand the commands that are listed here.
Seems that the effect of this pull is more than we expected. https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fghpr_unit_test/detail/ghpr_unit_test/12315/tests From the output, some tests were panicked after this patch.
PR needs rebase.
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.
Closing in favor of #54253