-
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
*: improve NULL count estimation for single column index (#9474) #9979
*: improve NULL count estimation for single column index (#9474) #9979
Conversation
@eurekaka build failed:
|
@@ -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", |
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: 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.
/run-all-tests 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 #9474