From: | "Tefft, Michael J" <Michael(dot)J(dot)Tefft(at)snapon(dot)com> |
---|---|
To: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Autovacuum and visibility maps |
Date: | 2024-12-03 16:32:22 |
Message-ID: | BN8PR04MB6289F7099F7B38E5B08D85B7D0362@BN8PR04MB6289.namprd04.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
We have some batch queries that had occasionally having degraded runtimes: from 2 hours degrading to 16 hours, etc.
Comparing plans from good and bad runs, we saw that the good plans used index-only scans on table "x", while the bad plans used index scans.
Using the pg_visibility utility, we found that all of the 83 partitions of table "x" were showing zero blocks where all tuples were visible. We ran a VACUUM on the table; the visibility maps are now clean and the good plans came back.
Our question is: why did autovacuum not spare us from this?
We are using default autovacuum parameters for all except log_autovacuum_min_duration=5000. These partitions are populated by processes that do a truncate + a single insert-select.
We see autovacuum failure (failed to get lock) messages, followed by a success message, in the log for one of these partitions (the biggest one) but even that partition showed zero blocks with all tuples visible.
Are we wrong to expect autovacuum to clean up the visibility map?
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 14.13 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22), 64-bit
Thank you,
Mike Tefft
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2024-12-03 16:57:26 | Re: Autovacuum and visibility maps |
Previous Message | Guillaume Lelarge | 2024-12-03 06:13:20 | Re: VACUUM FULL, power failure results in unrecoverable space |