Skip to content

Commit

Permalink
statistics: reuse datum when to buildHist (#47371)
Browse files Browse the repository at this point in the history
ref #47275
  • Loading branch information
hawkingrei authored Oct 7, 2023
1 parent 5e89d28 commit 753520a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion statistics/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ func buildHist(sc *stmtctx.StatementContext, hg *Histogram, samples []*SampleIte
memTracker.Release(bufferedReleaseSize)
}
}()
var upper = new(types.Datum)
for i := int64(1); i < sampleNum; i++ {
corrXYSum += float64(i) * float64(samples[i].Ordinal)
upper := hg.GetUpper(bucketIdx)
hg.UpperToDatum(bucketIdx, upper)
if memTracker != nil {
// tmp memory usage
deltaSize := upper.MemUsage()
Expand Down

0 comments on commit 753520a

Please sign in to comment.