Re: another autovacuum scheduling thread
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Robert Haas <robertmhaas@gmail.com>, Jeremy Schneider <schneider@ardentperf.com>, pgsql-hackers@postgresql.org
Date: 2025-10-23T20:24:34Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add rudimentary table prioritization to autovacuum.
- d7965d65fc5b 19 (unreleased) landed
-
Trigger more frequent autovacuums with relallfrozen
- 06eae9e6218a 18.0 cited
-
Harden nbtree page deletion.
- c34787f91058 14.0 cited
-
Check for interrupts inside the nbtree page deletion code.
- 3a01f68e35a3 12.0 cited
On Fri, 24 Oct 2025 at 08:33, Sami Imseih <samimseih@gmail.com> wrote: > Yeah, you’re correct, the list already exists; sorry I missed that. My > main concern is > the additional overhead of the sort operation, especially if we have > many eligible > tables and an aggressive autovacuum_naptime. It is true that there are reasons that millions of tables could suddenly become eligible for autovacuum work with the consumption of a single xid, but I imagine sorting the list of tables is probably the least of the DBAs worries for that case as sorting the tables_to_process list is going to take a tiny fraction of the time that doing the vacuum work will take. If your concern is that the sort could take too large a portion of someone's 1sec autovacuum_naptime instance, then you also need to consider that the list isn't likely to be very long as there's very little time for tables to become eligible in such a short naptime, and if the tables are piling up because autovacuum is configured to run too slowly, then lets fix that at the root cause rather than be worried about improving one area because another area needs work. If we think like that, we'll remain gridlocked and autovacuum will never be improved. TBH, I think that mindset has likely contributed quite a bit to the fact that we've made about zero improvements in this area despite nobody thinking that nothing needs to be done. There are also things that could be done if we were genuinely concerned and had actual proof that this could reasonably be a problem. sort_template.h would reduce the constant factor of the indirect function call overhead by quite a bit. On a quick test here with a table containing 1 million random float8 values, a Seq Scan and in-memory Sort, EXPLAIN ANALYZE reports the sort took about 21ms: (actual time=172.273..193.824). I really doubt anyone will be concerned with 21ms when there's a list of 1 million tables needing to be autovacuumed. David