Skip to content

Commit

Permalink
statistics: skip auto-analyze when it is executed outside the availab…
Browse files Browse the repository at this point in the history
…le time period (#49541) (#52097)

close #49552
  • Loading branch information
ti-chi-bot authored Mar 26, 2024
1 parent 78dfdf2 commit 1f6e613
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions statistics/handle/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,11 @@ func (h *Handle) HandleAutoAnalyze(is infoschema.InfoSchema) (analyzed bool) {
tbls[i], tbls[j] = tbls[j], tbls[i]
})
for _, tbl := range tbls {
// Sometimes the tables are too many. Auto-analyze will take too much time on it.
// so we need to check the available time.
if !timeutil.WithinDayTimePeriod(start, end, time.Now()) {
return false
}
//if table locked, skip analyze
if h.IsTableLocked(tbl.Meta().ID) {
continue
Expand Down

0 comments on commit 1f6e613

Please sign in to comment.