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: improve channel length for analyze #47960

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ func (e *AnalyzeExec) Next(ctx context.Context, _ *chunk.Chunk) error {

// Start workers with channel to collect results.
taskCh := make(chan *analyzeTask, concurrency)
resultChLen := min(concurrency*2, len(tasks))
resultsCh := make(chan *statistics.AnalyzeResults, resultChLen)
resultsCh := make(chan *statistics.AnalyzeResults, 1)
for i := 0; i < concurrency; i++ {
e.wg.Run(func() { e.analyzeWorker(taskCh, resultsCh) })
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/executor/analyze_col_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ func (e *AnalyzeColumnsExecV2) buildSamplingStats(
sc := e.ctx.GetSessionVars().StmtCtx

// Start workers to merge the result from collectors.
mergeResultCh := make(chan *samplingMergeResult, samplingStatsConcurrency)
mergeTaskCh := make(chan []byte, samplingStatsConcurrency)
mergeResultCh := make(chan *samplingMergeResult, 1)
mergeTaskCh := make(chan []byte, 1)
var taskEg errgroup.Group
// Start read data from resultHandler and send them to mergeTaskCh.
taskEg.Go(func() (err error) {
Expand Down