-
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,stats: don't re-calculate the index's ranges #12856
Conversation
Actually, i want to split the codes which only do code moving as a single pr. Maybe the second way is better. After we dicide the solution, i'll open a seperate pr to do it. |
One explain test is changed. Being checking. |
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.
Is there any progress?
@lzmhhh123 There's a bug in statistics. I just located it. |
├─IndexScan_8 33.33 cop[tikv] table:t1, index:c2, range:(1 1,1 +inf], keep order:false, stats:pseudo | ||
└─Selection_10 1.11 cop[tikv] lt(Column#3, 1) | ||
└─Selection_10 11.08 cop[tikv] lt(Column#3, 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.
This change is a bug related with statistics.
Since we take the RowID
column into consideration when the column of index are all be used.
But when calculating the selecitivity. https://github.com/pingcap/tidb/blob/master/statistics/selectivity.go#L215 Here we doesn't consider the RowID
column.
So the rowid column is calculated twice, which makes the final row count smaller.
I've tried but it's not very easy to fix. So we can make this pr merged first. Then i'll try to fix it in another pr.
Codecov Report
@@ Coverage Diff @@
## master #12856 +/- ##
===========================================
Coverage 80.5393% 80.5393%
===========================================
Files 480 480
Lines 120926 120926
===========================================
Hits 97393 97393
Misses 15974 15974
Partials 7559 7559 |
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.
LGTM
Please resolve the conflicts.
./run-all-tests |
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.
LGTM
What problem does this PR solve?
The things can be reused when calcuate ranges and selectivity.
What is changed and how it works?
Reuse them.
Check List
Tests
Code changes
Side effects