-
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
plan: improve row count estimation using column order correlation #9839
Conversation
/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.
Could you please add some comment to help us understanding the code. 😂
78ecb28
to
0f30d20
Compare
Codecov Report
@@ Coverage Diff @@
## master #9839 +/- ##
===========================================
Coverage ? 77.9438%
===========================================
Files ? 407
Lines ? 83555
Branches ? 0
===========================================
Hits ? 65126
Misses ? 13590
Partials ? 4839 |
5ff3017
to
13b6897
Compare
5acf74f
to
e51ac82
Compare
/run-all-tests |
@@ -44,18 +44,3 @@ IndexLookUp_11 0.00 root | |||
├─IndexScan_8 1.00 cop table:outdated_statistics, index:a, b, range:[1 1,1 1], keep order:false | |||
└─Selection_10 0.00 cop eq(test.outdated_statistics.c, 1) | |||
└─TableScan_9 1.00 cop table:outdated_statistics, keep order:false | |||
CREATE TABLE `unknown_correlation` ( |
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.
It's better to keep this test, or move it to another file. In order to discover plan regression.
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 test is moved to TestLimitCrossEstimation
.
for _, col := range cols { | ||
hist, ok := histColl.Columns[col.ID] | ||
if !ok { | ||
return nil, 0 |
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.
Why breaking here? Should we continue to compare other columns?
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.
If we don't know correlation of a column, we assume they are independent, so the whole condition should be treated as independent?
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
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?
Fix #9067
What is changed and how it works?
When estimating row count for TableScan with Limit pushed down:
tidb_opt_correlation_threshold
andtidb_opt_correlation_exp_factor
;Check List
Tests
Code changes
Side effects
Related changes