Re: New strategies for freezing, advancing relfrozenxid early
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>, John Naylor <john.naylor@enterprisedb.com>,
Andres Freund <andres@anarazel.de>, Justin Pryzby <pryzby@telsasoft.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-12-22T19:39:10Z
Lists: pgsql-hackers
Attachments
- v11-0001-Add-page-level-freezing-to-VACUUM.patch (application/x-patch) patch v11-0001
- v11-0002-Add-eager-and-lazy-freezing-strategies-to-VACUUM.patch (application/x-patch) patch v11-0002
- v11-0003-Add-eager-and-lazy-VM-strategies-to-VACUUM.patch (application/x-patch) patch v11-0003
- v11-0004-Finish-removing-aggressive-mode-VACUUM.patch (application/x-patch) patch v11-0004
On Wed, Dec 21, 2022 at 4:53 PM Peter Geoghegan <pg@bowt.ie> wrote: > Great. I plan on committing 0001 in the next few days. Committing 0002 > might take a bit longer. I pushed the VACUUM cutoffs patch (previously 0001) this morning - thanks for your help with that one. Attached is v11, which is mostly just to fix the bitrot caused by today's commits. Though I did adjust some of the commit messages a bit. There is also one minor functional change in v11: we now always use eager freezing strategy in unlogged and temp tables, since it's virtually guaranteed to be a win there. With an unlogged or temp table, most of the cost of freezing is just the cycles spent preparing to freeze, since, of course, there isn't any WAL overhead to have to worry about (which is the dominant concern with freezing costs, in general). Deciding *not* to freeze pages that we can freeze and make all-frozen in the VM from unlogged/temp tables seems like a case of wasting the cycles spent preparing freeze plans. Why not just do the tiny additional work of executing the freeze plans at that point? It's not like eager freezing strategy comes with an added risk that VACUUM will allocate new multis that it wouldn't otherwise have to allocate. Nor does it change cleanup-lock-wait behavior. Clearly this optimization isn't equivalent to interpreting vacuum_freeze_min_age as 0 in unlogged/temp tables. The whole design of freezing strategies is supposed to abstract away details like that, freeing up high level code like lazy_scan_strategy to think about freezing at the level of the whole table -- the cost model stuff really benefits from being able to measure debt at the table level, measuring things in terms of units like total all-frozen pages, rel_pages, etc. -- Peter Geoghegan
Commits
-
Revert "Add eager and lazy freezing strategies to VACUUM."
- 6c6b49726644 16.0 landed
-
Add eager and lazy freezing strategies to VACUUM.
- 4d4179926139 16.0 landed
-
Refine the definition of page-level freezing.
- b37a08323964 16.0 landed
-
Avoid special XID snapshotConflictHorizon values.
- 6daeeb1f9196 16.0 cited
-
Add page-level freezing to VACUUM.
- 1de58df4fec7 16.0 landed
-
Remove overzealous MultiXact freeze assertion.
- 63c844a0a5d7 16.0 landed
-
Refactor how VACUUM passes around its XID cutoffs.
- 4ce3afb82ecf 16.0 landed
-
Deduplicate freeze plans in freeze WAL records.
- 9e5405993c1e 16.0 cited
-
Set relfrozenxid to oldest extant XID seen by VACUUM.
- 0b018fabaaba 15.0 cited
-
Only skip pages marked as clean in the visibility map, if the last 32
- bf136cf6e376 8.4.0 cited
-
Add vacuum_freeze_table_age GUC option, to control when VACUUM should
- 6587818542e7 8.4.0 cited