From 6b491cf88eb226bdb553339cf59f77db6f226468 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Fri, 11 Oct 2024 12:52:36 +0800 Subject: [PATCH] This is an automated cherry-pick of #56538 Signed-off-by: ti-chi-bot --- pkg/statistics/handle/usage/session_stats_collect.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)