Skip to content

Commit

Permalink
executor: improve channel length for analyze (#47960)
Browse files Browse the repository at this point in the history
ref #47275
  • Loading branch information
hawkingrei authored Oct 26, 2023
1 parent a7366f9 commit 6dd6a5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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

0 comments on commit 6dd6a5e

Please sign in to comment.