Disabling vacuum truncate for autovacuum
Will Storey <will@summercat.com>
From: Will Storey <will@summercat.com>
To: pgsql-general@lists.postgresql.org
Date: 2024-12-17T00:25:06Z
Lists: pgsql-hackers, pgsql-general
Hi! I would like to disable vacuum's truncate behaviour for autovacuum. Previously I had an outage due to its access exclusive lock when it was replicated to a hot standby. When that outage happened it was from a VACUUM call in a cronjob rather than autovacuum. I now run such VACUUMs with TRUNCATE false which avoids the issue for these. However I've realized that autovacuum could cause this as well. This is of interest to me because I'm looking at tuning autovacuum and getting rid of the cronjob, but I've realized relying on autovacuum could be dangerous because of the truncates. I believe the only way to disable this for autovacuum is by changing the vacuum_truncate storage parameters on tables. (Ignoring the now removed old_snapshot_threshold option). I'm thinking of altering all my tables to turn it off. Is this a horrible idea? I expect I would need to monitor tables for problematic growth, but that might be better than a surprise outage. I suppose the growth could cause an outage too, but I'm thinking it would be more controllable. Would I need to disable the settings on catalog tables too? (To rule out any possibility of it happening). Are there any other things I might be missing? I am also wondering if having an autovacuum setting to control it would be a good idea for a feature. That would be simpler for me than altering all my tables and help me avoid missing any (e.g. catalogs, new tables). I might be worrying needlessly about this as maybe it is unlikely to happen. I suppose it is workload dependent. Thank you! Will
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Expand comment for isset_offset.
- 7d559c8580f7 18.0 landed
-
Add vacuum_truncate configuration parameter.
- 0164a0f9ee12 18.0 landed