diff --git a/pkg/statistics/handle/usage/session_stats_collect.go b/pkg/statistics/handle/usage/session_stats_collect.go index de152b9c28d3a..69789fae20b92 100644 --- a/pkg/statistics/handle/usage/session_stats_collect.go +++ b/pkg/statistics/handle/usage/session_stats_collect.go @@ -38,7 +38,14 @@ var ( // DumpStatsDeltaRatio is the lower bound of `Modify Count / Table Count` for stats delta to be dumped. DumpStatsDeltaRatio = 1 / 10000.0 // dumpStatsMaxDuration is the max duration since last update. +<<<<<<< HEAD dumpStatsMaxDuration = time.Hour +======= + dumpStatsMaxDuration = 5 * time.Minute + + // batchInsertSize is the batch size used by internal SQL to insert values to some system table. + batchInsertSize = 10 +>>>>>>> 0955c91c8c9 (statistics: reduce dumpStatsMaxDuration as 5min (#56538)) ) // needDumpStatsDelta checks whether to dump stats delta. @@ -65,7 +72,7 @@ func (s *statsUsageImpl) needDumpStatsDelta(is infoschema.InfoSchema, dumpAll bo item.InitTime = currentTime } if currentTime.Sub(item.InitTime) > dumpStatsMaxDuration { - // Dump the stats to kv at least once an hour. + // Dump the stats to kv at least once 5 minutes. return true } statsTbl := s.statsHandle.GetPartitionStats(tbl.Meta(), id)