-
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
statistics: fix wrong point range in crossValidationSelectivity #33357
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cherry-pick |
/help |
/cherry-pick-5.0 |
/label needs-cherry-pick-5.0 |
/label needs-cherry-pick-5.1 |
/label needs-cherry-pick-5.2 |
/label needs-cherry-pick-5.3 |
/label needs-cherry-pick-5.4 |
/run-unit-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f63db1c
|
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/9dc85cb659b10c100cdc365c8ab0b5adcbb08588 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.0 in PR #33486 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.1 in PR #33487 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.2 in PR #33488 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.3 in PR #33489 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.4 in PR #33490 |
What problem does this PR solve?
Issue Number: ref #28030
Problem Summary:
Fix the second problem described in #28030.
What is changed and how it works?
When we calculate the selectivity of multi-column equal conditions in
crossValidationSelectivity
, we construct the point range to calculate the selectivity for each column that has the equal condition, and then multiply these selectivities to get the final selectivity. However, we have a tiny fault when constructing the point range for each column, which is that we don't correctly setLowExclude
/HighExclude
. Since the column range is point range(LowVal
is equal toHighVal
), we need to set bothLowExclude
andHighExclude
to false. Otherwise we would get 0.0 estRow.You can try the unit test on master and will find the test fails. On master the optimizer thinks estRow of TableRangeScan is 0.00 rather than 2.00, which is wrong estimation.
Check List
Tests
Side effects
Documentation
Release note