postgresql/src/include/access
Peter Geoghegan 1de58df4fe Add page-level freezing to VACUUM.
Teach VACUUM to decide on whether or not to trigger freezing at the
level of whole heap pages.  Individual XIDs and MXIDs fields from tuple
headers now trigger freezing of whole pages, rather than independently
triggering freezing of each individual tuple header field.

Managing the cost of freezing over time now significantly influences
when and how VACUUM freezes.  The overall amount of WAL written is the
single most important freezing related cost, in general.  Freezing each
page's tuples together in batch allows VACUUM to take full advantage of
the freeze plan WAL deduplication optimization added by commit 9e540599.

Also teach VACUUM to trigger page-level freezing whenever it detects
that heap pruning generated an FPI.  We'll have already written a large
amount of WAL just to do that much, so it's very likely a good idea to
get freezing out of the way for the page early.  This only happens in
cases where it will directly lead to marking the page all-frozen in the
visibility map.

In most cases "freezing a page" removes all XIDs < OldestXmin, and all
MXIDs < OldestMxact.  It doesn't quite work that way in certain rare
cases involving MultiXacts, though.  It is convenient to define "freeze
the page" in a way that gives FreezeMultiXactId the leeway to put off
the work of processing an individual tuple's xmax whenever it happens to
be a MultiXactId that would require an expensive second pass to process
aggressively (allocating a new multi is especially worth avoiding here).
FreezeMultiXactId is eager when processing is cheap (as it usually is),
and lazy in the event of an individual multi that happens to require
expensive second pass processing.  This avoids regressions related to
processing of multis that page-level freezing might otherwise cause.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Jeff Davis <pgsql@j-davis.com>
Reviewed-By: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAH2-WzkFok_6EAHuK39GaW4FjEFQsY=3J0AAd6FXk93u-Xq3Fg@mail.gmail.com
2022-12-28 08:50:47 -08:00
..
amapi.h Revert changes in HOT handling of BRIN indexes 2022-06-16 15:02:49 +02:00
amvalidate.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
attmap.h Add 'missing_ok' argument to build_attrmap_by_name 2022-11-29 09:39:36 +01:00
attnum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_internal.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_page.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_pageops.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_revmap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_tuple.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_xlog.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
bufmask.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
clog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
commit_ts.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
detoast.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
genam.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
generic_xlog.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
gin.h Static assertions cleanup 2022-12-15 10:10:32 +01:00
gin_private.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
ginblock.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ginxlog.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
gist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gist_private.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
gistscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gistxlog.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
hash.h Speedup hash index builds by skipping needless binary searches 2022-11-24 17:21:44 +13:00
hash_xlog.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
heapam.h Add page-level freezing to VACUUM. 2022-12-28 08:50:47 -08:00
heapam_xlog.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
heaptoast.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
hio.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
htup.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
htup_details.h Static assertions cleanup 2022-12-15 10:10:32 +01:00
itup.h Convert macros to static inline functions (itup.h) 2022-07-19 07:24:55 +02:00
multixact.h Harmonize heapam and tableam parameter names. 2022-09-19 16:46:23 -07:00
nbtree.h Static assertions cleanup 2022-12-15 10:10:32 +01:00
nbtxlog.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
parallel.h Mark ParallelMessagePending as sig_atomic_t 2022-09-27 09:29:56 +09:00
printsimple.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
printtup.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
relation.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
reloptions.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
relscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rewriteheap.h Harmonize heapam and tableam parameter names. 2022-09-19 16:46:23 -07:00
rmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
rmgrlist.h Update the comment in rmgrlist.h to match it to the code. 2022-08-30 09:16:41 +05:30
sdir.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
session.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
skey.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
slru.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgist_private.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgxlog.h Standardize rmgrdesc recovery conflict XID output. 2022-11-17 14:55:08 -08:00
stratnum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
subtrans.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
syncscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
sysattr.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
table.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tableam.h Refactor how VACUUM passes around its XID cutoffs. 2022-12-22 09:37:59 -08:00
timeline.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
toast_compression.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
toast_helper.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
toast_internals.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
transam.h Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
tsmapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupconvert.h Generalize ri_RootToPartitionMap to use for non-partition children 2022-12-02 10:35:55 +01:00
tupdesc.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
tupdesc_details.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupmacs.h Convert macros to static inline functions (tupmacs.h) 2022-07-18 08:01:27 +02:00
twophase.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
twophase_rmgr.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
valid.h Turn HeapKeyTest macro into inline function 2022-11-16 13:26:48 +01:00
visibilitymap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
visibilitymapdefs.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xact.h Rethink handling of [Prevent|Is]InTransactionBlock in pipeline mode. 2022-12-13 14:23:58 -05:00
xlog.h Reduce xlog.h inclusion footprint 2022-10-12 09:47:11 +02:00
xlog_internal.h Mark argument of RegisterCustomRmgr() as const. 2022-11-15 16:01:35 -08:00
xlogarchive.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xlogbackup.h Remove dependency to StringInfo in xlogbackup.{c.h} 2022-09-27 09:15:07 +09:00
xlogdefs.h Remove configure probe for fdatasync. 2022-08-05 16:37:38 +12:00
xloginsert.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
xlogprefetcher.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
xlogreader.h Restore pg_pread and friends. 2022-09-29 13:12:11 +13:00
xlogrecord.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
xlogrecovery.h Remove promote_trigger_file. 2022-11-29 12:08:38 +13:00
xlogstats.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
xlogutils.h Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00