forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9e54059
committed
Deduplicate freeze plans in freeze WAL records.
Make heapam WAL records that describe freezing performed by VACUUM morespace efficient by storing each distinct "freeze plan" once, alongsidean array of associated page offset numbers (one per freeze plan). Thefreeze plans required for most heap pages tend to naturally have a greatdeal of redundancy, so this technique is very effective in practice. Itoften leads to freeze WAL records that are less than 20% of the size ofequivalent WAL records generated using the previous approach.The freeze plan concept was introduced by commit3b97e68, which fixedbugs in VACUUM's handling of MultiXacts. We retain the concept offreeze plans, but go back to using page offset number arrays. There isno loss of generality here because deduplication is an additive processthat gets applied mechanically when FREEZE_PAGE WAL records are built.More than anything else, freeze plan deduplication is an optimizationthat reduces the marginal cost of freezing additional tuples on pagesthat will need to have at least one or two tuples frozen in any case.Ongoing work that adds page-level freezing to VACUUM will take fulladvantage of the improved cost profile through batching.Also refactor some of the details surrounding recovery conflicts neededto REDO freeze records in passing: make original execution responsiblefor generating a standard latestRemovedXid cutoff, rather than workingbackwards to get the same cutoff in the REDO routine. Bugfix commit66fbcb0 did it the other way around, which is equivalent but obscureswhat's going on.Also rename the cutoff field from the WAL record/struct (rename thefield cutoff_xid to latestRemovedXid to match similar WAL records).Processing of conflicts by REDO routines is already completely uniform,so tools like pg_waldump should present the information driving theprocess uniformly. There are two remaining WAL record types that stilldon't quite follow this convention (heapam's VISIBLE record type andSP-GiST's VACUUM_REDIRECT record type). They can be brought into lineby later work that totally standardizes how the cutoffs are presented.Bump XLOG_PAGE_MAGIC.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>Reviewed-By: Nathan Bossart <nathandbossart@gmail.com>Reviewed-By: Justin Pryzby <pryzby@telsasoft.com>Discussion:https://postgr.es/m/CAH2-Wz=XytErMnb8FAyFd+OQEbiipB0Q2FmFdXrggPL4VBnRYQ@mail.gmail.com1 parent2fe3bdb commit9e54059
File tree
6 files changed
+312
-142
lines changed- src
- backend/access
- heap
- rmgrdesc
- include/access
6 files changed
+312
-142
lines changed0 commit comments
Comments
(0)