Re: New IndexAM API controlling index vacuum strategies
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Victor Yegorov <vyegorov@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-02-02T20:33:14Z
Lists: pgsql-hackers
On Tue, Feb 2, 2021 at 6:28 AM Victor Yegorov <vyegorov@gmail.com> wrote: > I really like this idea! Cool! > It resembles the approach used in bottom-up index deletion, block-based > accounting provides a better estimate for the usefulness of the operation. It does resemble bottom-up index deletion, in one important general sense: it is somewhat qualitative (though *also* somewhat quantitive). This is new for vacuumlazy.c. But the idea now is to deemphasize bottom-up index deletion heavy workloads in the first version of this patch -- just to cut scope. The design I described yesterday centers around "~99.9% append-only table" workloads, where anti-wraparound vacuums that scan indexes are a big source of unnecessary work (in practice it is always anti-wraparound vacuums, simply because there will never be enough garbage to trigger a regular autovacuum run). But it now occurs to me that there is another very important case that it will also help, without making the triggering condition for index vacuuming any more complicated: it will help cases where HOT updates are expected (because all updates don't modify indexed columns). It's practically impossible for HOT updates to occur 100% of the time, even with workloads whose updates never modify indexed columns. You can clearly see this by looking at the stats from pg_stat_user_tables with a standard pgbench workload. It does get better with lower heap fill factor, but I think that HOT is never 100% effective (i.e. 100% of updates are HOT updates) in the real world -- unless maybe you set heap fillfactor as low as 50, which is very rare. HOT might well be 95% effective, or 99% effective, but it's never truly 100% effective. And so this is another important workload where the difference between "practically zero dead tuples" and "precisely zero dead tuples" *really* matters when deciding if a VACUUM operation needs to go ahead. Once again, a small difference, but also a big difference. Forgive me for repeating myself do much, but: paying attention to cost/benefit asymmetries like this one sometimes allow us to recognize an optimization that is an "excellent deal". We saw this with bottom-up index deletion. Seems good to keep an eye out for that. > I suppose that 1% threshold should be configurable as a cluster-wide GUC > and also as a table storage parameter? Possibly. I'm concerned about making any user-visible interface (say a GUC) compatible with an improved version that is smarter about bottom-up index deletion (in particular, one that can vacuum only a subset of the indexes on a table, which now seems too ambitious for Postgres 14). -- Peter Geoghegan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Don't truncate heap when VACUUM's failsafe is in effect.
- 60f1f09ff443 14.0 landed
-
Teach VACUUM to bypass unnecessary index vacuuming.
- 5100010ee4d5 14.0 landed
-
Add wraparound failsafe to VACUUM.
- 1e55e7d1755c 14.0 landed
-
Truncate line pointer array during VACUUM.
- 3c3b8a4b2689 14.0 landed
-
Remove tupgone special case from vacuumlazy.c.
- 8523492d4e34 14.0 landed
-
Refactor lazy_scan_heap() loop.
- 7ab96cf6b312 14.0 landed
-
Propagate parallel VACUUM's buffer access strategy.
- 49f49defe7c0 14.0 cited
-
Simplify state managed by VACUUM.
- b4af70cb2103 14.0 landed
-
Notice that heap page has dead items during VACUUM.
- 0ea71c93a06d 14.0 landed
-
Adjust lazy_scan_heap() accounting comments.
- 7cde6b13a9b6 14.0 cited
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- 6655a7299d83 13.0 cited
-
Fix some problems with VACUUM (INDEX_CLEANUP FALSE).
- dd6959798885 12.0 cited