Skip to content
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

Merged
merged 3 commits into from
Mar 29, 2019

Conversation

eurekaka
Copy link
Contributor

cherry-pick #9738

@eurekaka eurekaka added type/bugfix This PR fixes a bug. sig/planner SIG: Planner type/2.1 cherry-pick labels Mar 28, 2019
@eurekaka eurekaka force-pushed the pick_corr_range branch 2 times, most recently from 36ce64b to 35f1ed7 Compare March 28, 2019 10:17
" └─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",
Copy link
Contributor Author

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.

@eurekaka
Copy link
Contributor Author

/run-all-tests tidb-test=release-2.1 tikv=release-2.1 pd=release-2.1

@eurekaka
Copy link
Contributor Author

/run-unit-test tidb-test=release-2.1 tikv=release-2.1 pd=release-2.1

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 29, 2019
Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zz-jason zz-jason merged commit 6b12ad5 into pingcap:release-2.1 Mar 29, 2019
@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 29, 2019
@eurekaka eurekaka deleted the pick_corr_range branch April 1, 2019 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants