File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ type StaleStatsEntry struct {
243243 LastAnalyzedDaysAgo * int64 `json:"last_analyzed_days_ago,omitempty"`
244244}
245245
246- // Walks MergedActivity per-node looking for tables without a recent (auto)analyze
246+ // Skip standbys: pg_statistic replicates via WAL but pg_stat_user_tables timestamps are per-node and autoanalyze never runs there.
247247func DetectStaleStats (a * AnnotatedSchema , staleDays int64 ) []StaleStatsEntry {
248248 if a == nil || a .Merged == nil {
249249 return nil
@@ -253,6 +253,9 @@ func DetectStaleStats(a *AnnotatedSchema, staleDays int64) []StaleStatsEntry {
253253 var entries []StaleStatsEntry
254254
255255 for _ , n := range a .Merged .Nodes {
256+ if n .Node .IsStandby {
257+ continue
258+ }
256259 for _ , ts := range n .Tables {
257260 var lastAnalyzed * time.Time
258261 if ts .Activity .LastAnalyze != nil {
You can’t perform that action at this time.
0 commit comments