Skip to content

Commit f71c47f

Browse files
committed
update
Signed-off-by: Weizhen Wang <[email protected]>
1 parent a2ccef5 commit f71c47f

File tree

1 file changed

+2
-2
lines changed
  • pkg/statistics/handle/storage

1 file changed

+2
-2
lines changed

pkg/statistics/handle/storage/gc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ func ClearOutdatedHistoryStats(sctx sessionctx.Context) error {
182182
}
183183
count := rows[0].GetInt64(0)
184184
if count > 0 {
185-
sql = "delete from mysql.stats_meta_history use index (idx_create_time) where create_time <= NOW() - INTERVAL %? SECOND limit 5000"
185+
sql = "batch on table_id limit 100 delete from mysql.stats_meta_history use index (idx_create_time) where create_time <= NOW() - INTERVAL %? SECOND"
186186
_, err = util.Exec(sctx, sql, variable.HistoricalStatsDuration.Load().Seconds())
187187
if err != nil {
188188
return err
189189
}
190-
sql = "delete from mysql.stats_history use index (idx_create_time) where create_time <= NOW() - INTERVAL %? SECOND limit 5000"
190+
sql = "batch on table_id limit 100 delete from mysql.stats_history use index (idx_create_time) where create_time <= NOW() - INTERVAL %? SECOND"
191191
_, err = util.Exec(sctx, sql, variable.HistoricalStatsDuration.Load().Seconds())
192192
logutil.BgLogger().Info("clear outdated historical stats")
193193
return err

0 commit comments

Comments
 (0)