Skip to content

Commit

Permalink
statCountMinFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SunRunAway committed Aug 30, 2019
1 parent 8a5087b commit 8def643
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion executor/join.go
Expand Up @@ -495,10 +495,15 @@ func (e *HashJoinExec) fetchInnerAndBuildHashTable(ctx context.Context) {

const (
// statCountMaxFactor defines the factor of maxStatCount with maxChunkSize.
// statCountMax is maxChunkSize * maxStatCountFactor.
// statCountMax is maxChunkSize * statCountMaxFactor.
// Set this threshold to prevent innerStatsCount being too large and causing a performance regression.
statCountMaxFactor = 10 * 1024

// statCountMinFactor defines the factor of statCountMin with maxChunkSize.
// statCountMin is maxChunkSize * statCountMinFactor.
// Set this threshold to prevent innerStatsCount being too small and causing a performance regression.
statCountMinFactor = 8

// statCountDivisor defines the divisor of innerStatsCount.
// Set this divisor to prevent innerStatsCount being too large and causing a performance regression.
statCountDivisor = 8
Expand All @@ -514,6 +519,9 @@ func (e *HashJoinExec) buildHashTableForList(innerResultCh <-chan *chunk.Chunk)
if statCount > e.maxChunkSize*statCountMaxFactor {
statCount = e.maxChunkSize * statCountMaxFactor
}
if statCount < e.maxChunkSize*statCountMinFactor {
statCount = 0
}
e.rowContainer = newHashRowContainer(e.ctx.GetSessionVars().StmtCtx, statCount,
e.innerExec.base().retFieldTypes, innerKeyColIdx,
e.initCap, e.maxChunkSize)
Expand Down

0 comments on commit 8def643

Please sign in to comment.