Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#56538
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
hawkingrei authored and ti-chi-bot committed Oct 18, 2024
1 parent df753d1 commit 6b491cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/statistics/handle/usage/session_stats_collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit 6b491cf

Please sign in to comment.