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

stats: refine estimate in buckets #4601

Merged
merged 10 commits into from Sep 22, 2017

Conversation

Projects
None yet
5 participants
@lamxTyler
Member

lamxTyler commented Sep 21, 2017

Previously, when the query range lies in the bucket, we use half of the bucket depth as an estimation. This PR uses the continuous-value assumption to estimate it.

PTAL @coocood @hanfei1991 @winoros

lamxTyler added some commits Sep 19, 2017

@shenli

Another suggestion: We could pre-calculate upper and lower to scalar.

Show outdated Hide outdated statistics/scalar.go
return convertOneBytesToScalar(lower[common:]), convertOneBytesToScalar(upper[common:]), convertOneBytesToScalar(value[common:])
}
func convertOneBytesToScalar(value []byte) float64 {

This comment has been minimized.

@coocood

coocood Sep 22, 2017

Member

This function is complex, how about using BigEndian.Uint64?

var buf [8]byte
copy(buf[:], value)
return float64(BigEndian.Uint64(buf[:])
@coocood

coocood Sep 22, 2017

Member

This function is complex, how about using BigEndian.Uint64?

var buf [8]byte
copy(buf[:], value)
return float64(BigEndian.Uint64(buf[:])
@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Sep 22, 2017

Member

LGTM

Member

coocood commented Sep 22, 2017

LGTM

@lamxTyler

This comment has been minimized.

Show comment
Hide comment
@lamxTyler

lamxTyler Sep 22, 2017

Member

/run-all-test

Member

lamxTyler commented Sep 22, 2017

/run-all-test

@winoros winoros merged commit 7eefb40 into master Sep 22, 2017

10 of 11 checks passed

jenkins-ci-tidb/unit-test Jenkins job failed
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 72.501%
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
jenkins-ci-tidb/common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
jenkins-ci-tidb/mybatis-test Jenkins job succeeded.
Details
jenkins-ci-tidb/sqllogic-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@winoros winoros deleted the xhb/est branch Sep 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment