-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: fix the inappropriate out-of-range range estimation rule #21207
base: master
Are you sure you want to change the base?
Conversation
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.
And also please modify https://github.com/pingcap/tidb/blob/master/statistics/histogram.go#L864 and https://github.com/pingcap/tidb/blob/master/statistics/histogram.go#L1012 to let the optimizer use the new estimation rule.
And also please add some unit tests :D @tangwz |
@tangwz Please fix the unit tests. Thanks! |
@Reminiscent @qw4990 PTAL. |
@tangwz: 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. |
@tangwz: The following tests failed, say
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. |
What problem does this PR solve?
Issue Number: close #20989
Problem Summary: fix the inappropriate out-of-range range estimation rule
What is changed and how it works?
What's Changed:
Add function
outOfRangeIntervalSelectivity
.How it Works:
When estimating the number of rows for ranges in
GetColumnRowCount
, if the range is out-of-range, for example, the range's upper bound is less than the minimum value in statistics, TiDB usesoutOfRangeEQSelectivity
, but this is inappropriate sinceoutOfRangeEQSelectivity
is created for point estimation instead of range estimation.It's better to create a new function
outOfRangeIntervalSelectivity
for range estimation.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note
No release note