Re: New IndexAM API controlling index vacuum strategies
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-12-28T22:06:40Z
Lists: pgsql-hackers
Attachments
- 0007-btvacuumstrategy-bottom-up-index-deletion-changes.patch (application/octet-stream) patch 0007
On Sun, Dec 27, 2020 at 11:41 PM Peter Geoghegan <pg@bowt.ie> wrote: > I experimented with this today, and I think that it is a good way to > do it. I like the idea of choose_vacuum_strategy() understanding that > heap pages that are subject to many non-HOT updates have a "natural > extra capacity for LP_DEAD items" that it must care about directly (at > least with non-default heap fill factor settings). My early testing > shows that it will often take a surprisingly long time for the most > heavily updated heap page to have more than about 100 LP_DEAD items. Attached is a rough patch showing what I did here. It was applied on top of my bottom-up index deletion patch series and your poc_vacuumstrategy.patch patch. This patch was written as a quick and dirty way of simulating what I thought would work best for bottom-up index deletion for one specific benchmark/test, which was non-hot-update heavy. This consists of a variant pgbench with several indexes on pgbench_accounts (almost the same as most other bottom-up deletion benchmarks I've been running). Only one index is "logically modified" by the updates, but of course we still physically modify all indexes on every update. I set fill factor to 90 for this benchmark, which is an important factor for how your VACUUM patch works during the benchmark. This rough supplementary patch includes VACUUM logic that assumes (but doesn't check) that the table has heap fill factor set to 90 -- see my changes to choose_vacuum_strategy(). This benchmark is really about stability over time more than performance (though performance is also improved significantly). I wanted to keep both the table/heap and the logically unmodified indexes (i.e. 3 out of 4 indexes on pgbench_accounts) exactly the same size *forever*. Does this make sense? Anyway, with a 15k TPS limit on a pgbench scale 3000 DB, I see that pg_stat_database shows an almost ~28% reduction in blks_read after an overnight run for the patch series (it was 508,820,699 for the patches, 705,282,975 for the master branch). I think that the VACUUM component is responsible for some of that reduction. There were 11 VACUUMs for the patch, 7 of which did not call lazy_vacuum_heap() (these 7 VACUUM operations all only dead a btbulkdelete() call for the one problematic index on the table, named "abalance_ruin", which my supplementary patch has hard-coded knowledge of). -- 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