-
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
executor: implement ANALYZE TABLE #1327
Conversation
if err != nil { | ||
return nil, errors.Trace(err) | ||
} | ||
result, err := stmt.Exec(e.ctx) |
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.
You can use util/sqlexec.RestrictedSQLExecutor
LGTM |
return nil | ||
} | ||
|
||
// collectSamples collects sample from the result set, use Reservoir Sampling algorithm. |
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.
use -> using ?
if len(samples) < maxSampleCount { | ||
samples = append(samples, row) | ||
} else { | ||
shouldAdd := ran.Float64() < float64(maxSampleCount)/float64(count) |
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.
why not rand a int between 0 and count + 1 ?
LGTM |
No description provided.