-
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: improve row count estimation for index range containing correlated columns (#9738) #9937
Conversation
36ce64b
to
35f1ed7
Compare
" └─Selection_20 0.80 cop eq(t1.a, test.t.a)", | ||
" └─TableScan_19 1.00 cop table:t, keep order:false", | ||
" └─TableScan_19 1.25 cop table:t, keep order:false", |
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.
For reviewers: this row count change is caused by the fact that index on column c
exists, so we would not analyze column c
, hence estimated NDV of column c
would be ndv = float64(ds.statisticTable.Count) * distinctFactor
, which is 8, not 10. This behavior is different with master branch, because after #9315, we would analyze column c
even if index on column c
exists.
87e59c8
to
4fc33ab
Compare
/run-all-tests tidb-test=release-2.1 tikv=release-2.1 pd=release-2.1 |
/run-unit-test tidb-test=release-2.1 tikv=release-2.1 pd=release-2.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.
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
cherry-pick #9738