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

executor: implement ANALYZE TABLE #1327

Merged
merged 5 commits into from
Jun 20, 2016
Merged

executor: implement ANALYZE TABLE #1327

merged 5 commits into from
Jun 20, 2016

Conversation

coocood
Copy link
Member

@coocood coocood commented Jun 17, 2016

No description provided.

@coocood
Copy link
Member Author

coocood commented Jun 17, 2016

@shenli @zimulala @hanfei19910905 PTAL

if err != nil {
return nil, errors.Trace(err)
}
result, err := stmt.Exec(e.ctx)
Copy link
Member

Choose a reason for hiding this comment

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

You can use util/sqlexec.RestrictedSQLExecutor

@shenli
Copy link
Member

shenli commented Jun 17, 2016

LGTM

return nil
}

// collectSamples collects sample from the result set, use Reservoir Sampling algorithm.
Copy link
Contributor

Choose a reason for hiding this comment

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

use -> using ?

if len(samples) < maxSampleCount {
samples = append(samples, row)
} else {
shouldAdd := ran.Float64() < float64(maxSampleCount)/float64(count)
Copy link

@hanfei19910905 hanfei19910905 Jun 20, 2016

Choose a reason for hiding this comment

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

why not rand a int between 0 and count + 1 ?

@hanfei19910905
Copy link

LGTM

@coocood coocood merged commit b8bf595 into master Jun 20, 2016
@coocood coocood deleted the coocood/analyze-table branch June 20, 2016 03:13
@coocood coocood mentioned this pull request Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants