| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, satyanarlapuram(at)gmail(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Add pg_stat_autovacuum_priority |
| Date: | 2026-04-01 15:07:14 |
| Message-ID: | ac00otrpVnWzZ_i4@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
0001:
- AutoVacuumScores *scores);
+ AutoVacuumPriority *priority);
IMHO we need to minimize these kinds of extraneous changes in this patch
set. AutoVacuumScores still seems accurate enough, even when the struct
contains some extra bool members.
- * A table whose autovacuum_enabled option is false is
- * automatically skipped (unless we have to vacuum it due to freeze_max_age).
- * Thus autovacuum can be disabled for specific tables. Also, when the cumulative
- * stats system does not have data about a table, it will be skipped.
+ * A table whose autovacuum_enabled option is false is automatically skipped
+ * by autovacuum (unless we have to vacuum it due to freeze_max_age),
+ * but scores are still computed. Also, when the cumulative stats system does
+ * not have data about a table, threshold-based scores will be zero.
I don't think we need to update this comment.
- * One exception to the previous paragraph is for tables nearing wraparound,
- * i.e., those that have surpassed the effective failsafe ages. In that case,
- * the relfrozen/relminmxid-based score is scaled aggressively so that the
- * table has a decent chance of sorting to the front of the list.
+ * Furthermore, for tables nearing wraparound, i.e., those that have surpassed
+ * the effective failsafe ages, the relfrozen/relminmxid-based score is scaled
+ * aggressively so that the table has a decent chance of sorting to the front
+ * of the list.
Or this one.
+ * Priority scores are always computed. dovacuum and doanalyze are only set when
+ * autovacuum is active and enabled for the relation.
I think we should more explicitly state that while scores->needs_vacuum and
friends are always set regardless of whether autovacuum is enabled, the
return parameters dovacuum, etc., are not. Or perhaps we should return
whether autovacuum is enabled in the struct and consolidate the return
parameters and the struct members. WDYT?
0002:
Seems fine.
0003:
Seems fine.
0004:
+ FROM pg_stat_get_autovacuum_priority() S
+ JOIN pg_class C ON C.oid = S.relid
+ LEFT JOIN pg_namespace N ON N.oid = C.relnamespace;
What do you think about ordering by score so this view automatically shows
the tables most in need of vacuuming/analyzing first?
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Antonin Houska | 2026-04-01 15:16:58 | Re: table AM option passing |
| Previous Message | Srinath Reddy Sadipiralla | 2026-04-01 14:55:54 | Re: Adding REPACK [concurrently] |