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

*: improve NULL count estimation for single column index (#9474) #9979

Merged
merged 6 commits into from
Apr 2, 2019

Conversation

eurekaka
Copy link
Contributor

@eurekaka eurekaka commented Apr 1, 2019

cherry-pick #9474

@eurekaka eurekaka added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner type/2.1 cherry-pick labels Apr 1, 2019
@zz-jason
Copy link
Member

zz-jason commented Apr 2, 2019

@eurekaka build failed:

planner/core/planbuilder.go:657:5: undefined: idxNames
make: *** [server] Error 2
script returned exit code 2

@@ -278,7 +278,7 @@ func (s *testAnalyzeSuite) TestIndexRead(c *C) {
},
{
sql: "select count(*) from t where e > 1 group by b",
best: "IndexLookUp(Index(t.b)[[NULL,+inf]], Table(t)->Sel([gt(test.t.e, 1)]))->StreamAgg",
best: "TableReader(Table(t)->Sel([gt(test.t.e, 1)])->HashAgg)->HashAgg",
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: before this PR, column b is not analyzed because of the existence of index on b, so estimated NDV of b is about 8000; after this PR, estimated NDV of b is 100 which is consistent with data, and the plan is changed due to this NDV change.

@eurekaka
Copy link
Contributor Author

eurekaka commented Apr 2, 2019

/run-all-tests 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 Apr 2, 2019
Copy link
Member

@zz-jason zz-jason 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 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 2, 2019
@zz-jason zz-jason merged commit 59eb553 into pingcap:release-2.1 Apr 2, 2019
@eurekaka eurekaka deleted the pick_null_estimation_2.1 branch April 2, 2019 12:14
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/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants