Skip to content

Commit

Permalink
statistics: refine table filtering in analysis job creation to exclud…
Browse files Browse the repository at this point in the history
…e memory and system databases

Signed-off-by: Rustin170506 <[email protected]>
  • Loading branch information
Rustin170506 committed Jan 9, 2025
1 parent a874b44 commit 6b12f7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/statistics/handle/autoanalyze/priorityqueue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ func (pq *AnalysisPriorityQueue) fetchAllTablesAndBuildAnalysisJobs() error {

jobFactory := NewAnalysisJobFactory(sctx, autoAnalyzeRatio, currentTs)
snapshot := sctx.GetStore().GetSnapshot(kv.NewVersion(currentTs))
is := sctx.GetDomainInfoSchema().(infoschema.InfoSchema)
m := meta.NewReader(snapshot)
tbls := make([]*model.TableInfo, 0, 1024)
if err := m.IterAllTables(func(info *model.TableInfo) error {
// Ignore the memory and system database.
// if util.IsMemOrSysDB(db.L) {
// continue
// }
db, ok := is.SchemaByID(info.DBID)
if !ok || util.IsMemOrSysDB(db.Name.L) {
return nil
}
tbls = append(tbls, info)
return nil
}); err != nil {
Expand Down

0 comments on commit 6b12f7b

Please sign in to comment.