t.d
← the shelf

LLM paper · No. 02

PostgreSQL MVCC, Vacuum and the Write-Ahead Log

How Postgres keeps every version of a row, and the machinery that cleans up after it.

Written by an LLM on a weekly routine, from public sources — docs, papers, source code and engineering blogs, cited inline. Good for building a mental map; check the sources before relying on a detail.

Introduction: A Table That Keeps Its Old Rows

Most relational engines change a row where it lies and put the previous value somewhere else in case a reader still needs it. PostgreSQL does the reverse. An UPDATE writes a complete new copy of the row into the table and leaves the old copy in place, stamped with the ID of the transaction that replaced it. A DELETE only stamps. Nothing is physically removed until some later pass can prove that no transaction is still able to see the old copy.

The decision predates SQL in Postgres. The storage manager of Berkeley POSTGRES was specified in a 1987 technical report whose abstract says it "supports transaction management but does so without using a conventional write ahead log (WAL)", and that "there is no code to run at recovery time", which made crash recovery close to instant.1 Old versions were a feature then: queries could read the past. The open-source project reshaped that design in three steps that its release notes record. Release 6.3 (March 1998) removed "time travel" for performance reasons.2 Release 6.5 (June 1999) used "the natural multiversion nature of PostgreSQL" to replace table-level locking with multiversion concurrency control. Release 7.1 (April 2001) added a write-ahead log, because until then every commit had "forced all data modifications to disk".2

Today's engine is therefore a hybrid. Versions live side by side in the table, snapshots choose among them, and a redo log makes page changes durable and shippable. The manual states the benefit: each statement sees a snapshot of the data as it was at some earlier instant, and because read locks and write locks do not conflict, "reading never blocks writing and writing never blocks reading".3 The price is the rest of this paper: dead versions that have to be found and removed, index entries that point at them, a 32-bit transaction counter that must never be allowed to lap itself, and a log that grows with every page touched.

The paper follows one row through that machinery: its bytes on a heap page (Section 1), the snapshot test that decides who sees it (Section 2), the tricks that keep updates cheap (Section 3), vacuum and freezing (Section 4), the write-ahead log (Section 5), replication (Section 6), and a comparison with the undo-log designs of InnoDB and Oracle (Section 7). Version-dependent details describe PostgreSQL 18 as of the 18.7 minor release of 12 November 2026, read from the REL_18_STABLE source tree.4 PostgreSQL 19 has not shipped as this is written; its release notes carry a release date of 19 November 2026, and where 19 changes a behaviour described here the text says so.5

Section 1: Row Versions on the Heap

1.1 Pages and line pointers

A table is an array of fixed-size pages, 8 kB unless the server was compiled otherwise. A heap page has a 24-byte header, then an array of 4-byte item identifiers (line pointers), then free space, then the tuples, which are allocated backwards from the end of the page.6

 byte 0                                                           byte 8192
 +-----------+--------------------+----------------+----------------------+
 |  header   | lp1 lp2 lp3  -->   |   free space   |  <--  tup3 tup2 tup1 |
 |  24 bytes | 4 bytes each       |                |                      |
 +-----------+--------------------+----------------+----------------------+
   pd_lsn                         ^                ^
   pd_prune_xid               pd_lower         pd_upper
   pd_flags

 TID (ctid) = (page number, line pointer number), for example (42,3)

A row's address, its TID, is a page number plus a line pointer number, not a byte offset. Because a line pointer "is never moved until it is freed", the tuple behind it can be shifted inside the page to compact free space without invalidating anything that holds the TID.6 Indexes hold TIDs, so this one level of indirection is what later allows a page to be cleaned up without touching any index. Two header fields come back in later sections: pd_lsn, the WAL position just past the last record that changed the page, and pd_prune_xid, the oldest unpruned xmax on the page, a hint that pruning might find something to remove.6

1.2 The tuple header

Every row version starts with a fixed header, 23 bytes on most machines, followed by an optional null bitmap and then the column data.6 The fields that carry MVCC are these:

FieldSizeMeaning
t_xmin4 bytesXID of the transaction that inserted this version
t_xmax4 bytesXID of the transaction that deleted, replaced or locked it; 0 if none
t_cid4 bytescommand number inside the inserting or deleting transaction
t_ctid6 bytesthis version's own TID, or the TID of the version that replaced it
t_infomask2, t_infomask2 + 2 bytesattribute count and flag bits
t_hoff1 byteoffset to the column data

The layout is in the storage chapter of the manual; the flag bits are defined in htup_details.h.6, 7 HEAP_XMIN_COMMITTED and HEAP_XMIN_INVALID cache the fate of the inserting transaction, and a matching pair does the same for xmax. Setting both XMIN bits at once, a combination that otherwise makes no sense, means "frozen". HEAP_XMAX_LOCK_ONLY and HEAP_XMAX_IS_MULTI change how xmax is read, and HEAP_HOT_UPDATED and HEAP_ONLY_TUPLE mark the two ends of a HOT link (Section 3).7 The header is kept small by overlaying fields: the insert and delete command IDs share t_cid, since they only matter while the transaction that set them is running.7

All of this can be read from SQL with the pageinspect extension, which is the quickest way to make the rest of this section concrete:8

CREATE EXTENSION pageinspect;

SELECT lp, t_xmin, t_xmax, t_ctid, raw_flags
FROM heap_page_items(get_raw_page('accounts', 0)),
     LATERAL heap_tuple_infomask_flags(t_infomask, t_infomask2)
WHERE t_infomask IS NOT NULL OR t_infomask2 IS NOT NULL;

1.3 What INSERT, UPDATE and DELETE write

An INSERT stores a tuple with xmin set to the inserting transaction and t_ctid pointing at itself. A DELETE writes the deleter's XID into xmax and changes nothing else. An UPDATE does both: it sets xmax on the old version, stores a new version whose xmin is the updater, and repoints the old version's t_ctid at the new one. A tuple is the latest version of its row exactly when its xmax is invalid or its t_ctid points to itself.7

The t_ctid links form an update chain from older versions to newer ones. Anyone following it must check that the next tuple's xmin equals the previous tuple's xmax, because the slot the link points to may have been vacuumed and reused for an unrelated row in the meantime.7

Two consequences are worth stating early. Rollback costs nothing at the storage level: an aborted transaction leaves its versions where they are, and every reader ignores them. And an update is priced like an insert: a whole new tuple even when one byte changed, plus index work that Section 3 deals with.

Transaction IDs are handed out lazily. A transaction gets a permanent XID only when it first does something that needs one, typically modifying a tuple; until then it has a virtual transaction ID built from its backend slot number and a local counter, which never appears on disk.9 The stored XID is 32 bits wide. A 64-bit xid8 that includes a wraparound epoch exists for SQL-level functions, but the tuple header holds only the low 32 bits.10 Section 4 is largely about the consequences.

1.4 Commit status: pg_xact and hint bits

A tuple header says which transaction created the version, not whether that transaction committed. The verdict lives in pg_xact, two bits per transaction: in progress, committed, aborted, or sub-committed (a transient state used while a transaction with subtransactions commits).11, 9 A few pages of it are cached in shared memory, so most lookups do not touch disk.9

Looking up pg_xact for every tuple of every scan would still be slow, so the answer is cached in the tuple. The visibility routines update a tuple's hint bits when they see that the inserting or deleting transaction "has now committed or aborted", and mark the buffer dirty.12 This is why the first SELECT over freshly loaded data writes pages: it is setting HEAP_XMIN_COMMITTED on every row.

Hint bits obey one rule. A "committed" hint must not reach disk before the commit record it describes. With asynchronous commit (Section 5.4) the commit record may still be in memory, so pg_xact remembers the newest commit LSN for each group of 32 transactions and the hint is left unset until WAL has been flushed that far.9 Hint-bit changes are otherwise not WAL-logged. The exception is a cluster with data checksums or wal_log_hints enabled: there the first hint written to a clean page after a checkpoint emits a full image of the page, so that a torn write of the hinted page can be repaired from WAL instead of leaving a page that fails its checksum.9, 13 PostgreSQL 18 made checksums the initdb default, so on new clusters a read-only query can generate WAL.4

1.5 Row locks and MultiXacts

Row locks are stored in the row. A transaction may lock any number of rows, which rules out keeping row locks in shared memory, so SELECT ... FOR UPDATE writes the locker's XID into xmax and sets flag bits that say "lock, not delete".14 There are four strengths: FOR KEY SHARE, FOR SHARE, FOR NO KEY UPDATE and FOR UPDATE. The weakest exists for foreign keys: it is "just strong enough to implement RI checks", so a check against a parent row does not block an update of that row's non-key columns.14

One xmax field can hold one XID. When several transactions lock the same row, PostgreSQL allocates a MultiXact ID, stores the member list under pg_multixact, and puts the MultiXact ID in xmax.14, 11 MultiXact IDs are a second 32-bit counter with its own wraparound problem, which Section 4.6 returns to.11

Section 2: Snapshots and Visibility

2.1 What a snapshot is

A tuple carries the IDs of the transactions that created and removed it. A query carries a snapshot: a small description of which transactions' effects it is allowed to see. In snapshot.h the working parts are:15

TransactionId  xmin;     /* all XID < xmin are visible to me */
TransactionId  xmax;     /* all XID >= xmax are invisible to me */
TransactionId *xip;      /* XIDs in progress when the snapshot was taken */
TransactionId *subxip;   /* the same, for subtransactions */
bool           suboverflowed;
CommandId      curcid;   /* in my own xact, CID < curcid are visible */

The rule is that a snapshot "can never see the effects of XIDs >= xmax" and sees every older XID except those listed as in progress; xmin is only an optimisation that spares most tuples a search of the array.15 SQL exposes the same thing: pg_current_snapshot() returns text such as 10:20:10,14,15, meaning xmin 10, xmax 20, and 10, 14 and 15 still running.16

Taking a snapshot means reading the shared array of running transactions, and it has to be atomic with respect to commits. Suppose transaction A waits on a row lock held by B, B commits, and A then commits right behind it. A snapshot that recorded B as running but A as finished would see the row version B deleted and the one A inserted. PostgreSQL prevents this by brute force: snapshot takers hold ProcArrayLock in shared mode, and a transaction with an XID must take it exclusively to remove itself from the running set, so nobody can leave while a snapshot is being built. The same lock protects latestCompletedXid, and a snapshot's xmax is that value plus one.9

Building a snapshot used to scale poorly on large machines for a different reason. It also computed the global xmin horizon, by reading every backend's advertised xmin, a field that changes far more often than the XIDs a snapshot depends on, so the cache lines holding it bounced between cores. Since PostgreSQL 14 it does not: snapshots maintain two approximate cut-offs, and an exact horizon is computed only when a pruning decision falls between them.9, 17

2.2 The visibility test

Given a tuple and a snapshot, HeapTupleSatisfiesMVCC() answers yes or no. Leaving out MultiXacts, the transaction's own deletes and upgrade leftovers, its logic is:12

visible(t, snap):
  # 1. can I see the insert?
  if hint(t.xmin) == aborted:            return false
  if hint(t.xmin) != committed:
      if t.xmin is my own transaction:   return visible_to_command(t, snap.curcid)
      if in_progress(t.xmin, snap):      return false
      if pg_xact(t.xmin) == committed:   set hint XMIN_COMMITTED
      else:                              set hint XMIN_INVALID; return false
  elif not frozen(t) and in_progress(t.xmin, snap):
      return false                       # committed, but after my snapshot
  # 2. the insert is visible; can I also see the delete?
  if t.xmax is invalid or lock-only:     return true
  if in_progress(t.xmax, snap):          return true
  if pg_xact(t.xmax) == committed:       return false
  return true                            # the deleter aborted

in_progress(xid, snap):
  return xid >= snap.xmax or (xid >= snap.xmin and xid in snap.xip)

Three details matter. First, the snapshot is consulted before pg_xact. A committing transaction is marked committed in pg_xact before it leaves the running set, so for a moment it is both, and a reader that asked pg_xact first could see a commit that its own snapshot says has not happened yet.12 Second, a "committed" hint does not end the test: the transaction may have committed after the snapshot was taken, so the snapshot is still checked. Third, a frozen tuple skips the comparison entirely, which is the point of freezing.

Cleanup asks a harder question with the same ingredients. HeapTupleSatisfiesVacuum() wants to know whether a version is dead to every running transaction, not just one.12 The answer depends on the oldest xmin that any snapshot in the system still holds, usually called the xmin horizon. A deleted version whose xmax is not older than the horizon has to stay, however many times the row has been updated since.

2.3 Isolation levels are snapshot lifetimes

The isolation levels differ in how long a snapshot is kept and in what a writer does when it meets a row someone else changed.3

LevelSnapshot takenRow changed by a concurrent commit
Read Committed (default)at the start of each statementwait, then re-check the WHERE clause against the new version and carry on
Repeatable Readat the transaction's first non-control statementERROR: could not serialize access due to concurrent update
Serializableas Repeatable Readas Repeatable Read, plus aborts when read/write dependencies could form a cycle

Read Committed rarely fails because it follows the update chain to the newest version and re-evaluates. The cost is that one statement can act on a mix of states: it sees a concurrent change to the row it is updating but not that transaction's changes to other rows.3 Repeatable Read cannot do this, since the new version is invisible to its snapshot by definition, so it reports a serialization failure and the application retries. It is what the literature calls snapshot isolation. It allows no phantom reads, which is stronger than the SQL standard requires, yet it is not serializable; the manual's example is a read-only report that sees a batch marked complete but misses one of its detail rows. Requests for READ UNCOMMITTED get Read Committed.3

2.4 Serializable without blocking

Until 9.1, asking for Serializable gave you snapshot isolation.3 The current implementation, Serializable Snapshot Isolation, keeps snapshot isolation running as before and watches for the one pattern that can break it. When a transaction reads data that a concurrent transaction writes, the reader behaves as if it ran first; the README calls this an rw-conflict. Every snapshot-isolation anomaly is a cycle of dependencies that contains two rw-conflicts in a row, Tin → Tpivot → Tout. SSI tracks those edges and aborts a transaction when the structure appears. Not every such structure is part of a real cycle, so some aborts are false positives, accepted to keep the detection overhead low.18

Finding rw-conflicts requires remembering what each transaction read. Predicate locks do that. They show up in pg_locks as SIReadLock, never block anything, and are promoted from tuple to page to relation granularity when memory runs short, which raises the false-positive rate.3 About 90% of the SSI code is this predicate locking.18 Two refinements cut the abort rate: an abort is needed only if Tout commits first, and a read-only Tin is safe unless Tout committed before its snapshot. A READ ONLY DEFERRABLE transaction waits for a snapshot that cannot be part of any anomaly and then takes no predicate locks.18, 3 The feature's authors, Kevin Grittner and Dan Ports, wrote it up for VLDB 2012; the paper's abstract reports performance "only slightly below that of snapshot isolation", and well ahead of two-phase locking on read-intensive workloads.18, 19 Applications must be ready to retry on SQLSTATE 40001.3

2.5 Subtransactions and the 64-entry cache

A SAVEPOINT or a PL/pgSQL EXCEPTION block starts a subtransaction. One that writes gets its own XID, and its parent is recorded in pg_subtrans.10 Other sessions must treat those XIDs as running, so each backend advertises up to 64 of them in shared memory (PGPROC_MAX_CACHED_SUBXIDS, annotated "XXX guessed-at value"). If no cache has overflowed, an XID absent from the array is known not to be running. Once one has, that inference is gone and readers have to consult pg_subtrans.20 The manual puts it plainly: past 64 open subxids, "the storage I/O overhead increases significantly".10 GitLab spent a month in 2021 removing subtransactions from its application after tracing query stalls to this mechanism.21

Section 3: Making Updates Affordable

3.1 The index problem

Indexes store TIDs, and a new version lives at a new TID. Without further help, every update therefore inserts a new entry into every index on the table, even when no indexed column changed: "every version of a row in an update chain has its own index entries, even if all indexed columns are the same".22 On a table with eight indexes, bumping one unindexed counter modifies at least nine pages.

Removal is just as awkward. A dead version cannot be deleted until the index entries pointing at it are gone, and finding them means either scanning the indexes or recomputing the keys, which is unsafe when an expression index calls a user function that is not as immutable as it claims. Vacuum's answer is to scan each index once and delete in bulk, an approach that "does not scale down well to the case of reclaiming just a few tuples".22

3.2 Heap-only tuples

Heap-only tuples (HOT), added in 8.3, remove both costs for the common case.23 An update is HOT when it changes no column referenced by any index, including columns used only in a partial-index predicate, and the new version fits on the same page as the old one. The new version then gets no index entries at all. It is flagged HEAP_ONLY_TUPLE, the old version is flagged HEAP_HOT_UPDATED, and an index scan that arrives at the old version follows t_ctid forward within the page until it finds the member its snapshot can see.22 "Changed" means a different binary representation, not inequality under the type's operators.22

The same-page rule is deliberate. A chain that crossed pages "would destroy the desired property of being able to reclaim space with just page-local manipulations".22 Summarizing indexes are exempt from the first rule: BRIN stores per-block-range summaries, not TIDs, so an update to a column indexed only by BRIN is still HOT and the summary is updated on the side.22, 6

Before pruning: three versions, one index entry index entry lp 1 lp 2 lp 3 v1 dead v2 dead v3 live t_ctid links v1 to v2 to v3, all on this page After pruning: lp 1 redirects, lp 2 is reusable index entry lp 1 redirect lp 2 unused lp 3 v3 live space of v1 and v2 is free again
Figure 1. A HOT chain and what pruning leaves behind. The index still points at line pointer 1, so no index is touched. Schematic, after the diagrams in README.HOT.22

3.3 Pruning: cleanup without vacuum

Because only the root line pointer is referenced from outside the page, everything behind it can be rearranged locally. Once the older chain members are dead to every snapshot, pruning turns the root line pointer into a redirect to the first surviving member, frees the intermediate line pointers, and defragments the page so the reclaimed bytes join the central free space.22

Any backend that reads the page may do this, including one running a plain SELECT. The trigger in heap_page_prune_opt() is cheap by design: the page's pd_prune_xid must be older than the removal horizon, and the page must be nearly full, meaning free space below the larger of the fillfactor reserve and 10% of the page, or a previous update failed to fit. The backend then tries for a cleanup lock without waiting and gives up if someone else has the page pinned.24, 22 Standbys never prune, since they cannot write WAL.24

Pruning has a limit. When the whole chain is dead, because the row was deleted or a later update could not be HOT, the root line pointer cannot be freed: index entries still point at it. It is marked dead, keeps its four bytes, and waits for vacuum, the only process that removes index entries in bulk.22

3.4 Fillfactor: leaving room on purpose

HOT needs free space on the row's own page, and by default there is none to begin with: a table's fillfactor is 100, so inserts pack pages completely.25 Lowering it reserves part of every page for later versions. It is a trade of table size for update cost, and it is not always needed, because rows that are updated tend to migrate to pages that have room.6 The statistics views show whether it is working:

ALTER TABLE accounts SET (fillfactor = 85);   -- inserts leave 15% of each page free

SELECT n_tup_upd, n_tup_hot_upd, n_tup_newpage_upd, n_dead_tup
FROM pg_stat_all_tables WHERE relname = 'accounts';

3.5 Index-side cleanup

Updates that do change an indexed column still add index entries, and B-tree indexes have two defences of their own. In simple deletion, an index scan that fetches a heap tuple and finds it dead to everyone marks the index entry LP_DEAD, the index equivalent of a hint bit, and marked entries are deleted before the leaf page is allowed to split.26 Bottom-up deletion, added in PostgreSQL 14, runs when a leaf page is about to split because it has filled with versions of the same logical rows: it asks the heap which of the duplicates are dead and deletes those, as "a backstop against accumulating an excessive number of index tuple versions" for any one logical row.27, 26, 28 Neither replaces vacuum, but together they keep version churn from splitting index pages.

3.6 The visibility map and index-only scans

Index entries carry no visibility information, so an index scan must normally visit the heap for every match just to run the test from Section 2.2. The visibility map (VM) removes most of those visits. It keeps two bits per heap page: all-visible (every tuple on the page is visible to every transaction) and all-frozen.6 An index-only scan checks the bit for the page a TID points into, and if it is set, returns the row from the index alone. The map is about four orders of magnitude smaller than the heap, so it stays in memory.29

The map is conservative. A set bit is a guarantee and a clear bit means "unknown". Any change to a page clears its bit as part of the same WAL-logged change. Setting a bit is WAL-logged too, because the bit must agree with a flag on the heap page after a crash; otherwise the next writer would not know to clear it and index-only scans could return wrong answers.30 Through PostgreSQL 18 only vacuum (and COPY ... FREEZE) sets bits, which makes index-only scan performance on a busy table a function of how recently it was vacuumed. PostgreSQL 19 lets ordinary table scans set all-visible as well.6, 5

Section 4: Vacuum, Autovacuum and Freezing

4.1 What vacuum is for

The manual gives VACUUM four jobs: recover the space held by dead row versions, refresh planner statistics, maintain the visibility map, and protect against transaction ID and MultiXact wraparound.11 Plain VACUUM runs alongside normal reads and writes. It makes dead space reusable inside the table but does not hand it back to the operating system, except when pages at the very end of the file are empty and it can briefly take an exclusive lock to truncate them. The goal is a steady state, in which a table occupies its minimum size plus whatever accumulates between two runs.11

VACUUM FULL is a different operation: it rewrites the whole table and its indexes under an ACCESS EXCLUSIVE lock, needs disk space for the copy, and is never issued by autovacuum.11 PostgreSQL 19 folds it and CLUSTER into a new REPACK command, whose CONCURRENTLY option rebuilds a table without blocking readers and writers.5

4.2 One pass, three phases

A vacuum of one table moves through three phases, described at the top of vacuumlazy.c:31

  1. Heap scan. Read each page the visibility map does not let it skip, prune and freeze it, and record the TIDs of the dead line pointers left behind in an in-memory TID store.
  2. Index vacuuming. Scan every index once and delete the entries whose TIDs are in the store.
  3. Heap vacuuming. Return to the heap pages named in the store and mark those line pointers unused.

The order is the point. A line pointer may be reused only after no index entry refers to it, or an old index entry would lead to an unrelated row. Afterwards vacuum may truncate the file and it updates the table's statistics.31

The TID store is bounded by maintenance_work_mem (64 MB by default) or autovacuum_work_mem. When it fills, phases 2 and 3 run and the heap scan resumes, so every refill costs another full scan of every index.31, 13 Until PostgreSQL 17 the store was a plain array, searched by binary search and limited to 1 GB. The radix-tree store that replaced it has no such cap and often needs an order of magnitude less memory, which "should make multiple rounds of heap scanning and index cleanup an extremely rare event".32, 33

Two shortcuts keep routine vacuums cheap. If at most 2% of the table's pages contain dead line pointers, vacuum skips phases 2 and 3 and leaves those few pointers for next time, because a full index scan to remove a handful of entries is a bad trade.34, 31 And a vacuum that is not aggressive (Section 4.6) passes over a page when it cannot get the cleanup lock immediately, so one pinned buffer does not stall it.31 In PostgreSQL 18 vacuum's reads also go through the new asynchronous I/O subsystem.4

4.3 When autovacuum runs

A launcher process starts a worker in each database every autovacuum_naptime (one minute), with at most autovacuum_max_workers (3) running at once. Each worker walks the tables of its database and compares their statistics with two thresholds:11, 13

dead tuples     > min(autovacuum_vacuum_max_threshold,              -- 100,000,000
                      autovacuum_vacuum_threshold                    -- 50
                      + autovacuum_vacuum_scale_factor * reltuples)  -- 0.2

inserted tuples > autovacuum_vacuum_insert_threshold                 -- 1000
                  + autovacuum_vacuum_insert_scale_factor            -- 0.2
                    * reltuples * (1 - relallfrozen / relpages)

The first is the classic rule: vacuum once a fifth of the table is dead. On a billion-row table that is 200 million dead rows; the absolute cap, new in PostgreSQL 18, halves it.4 The second exists for append-only tables, which never produce dead rows but still need their pages marked all-visible and frozen; it is scaled by the unfrozen fraction of the table.11 Both can be overridden per table:

ALTER TABLE events SET (autovacuum_vacuum_scale_factor = 0.01,
                        autovacuum_vacuum_insert_scale_factor = 0.02);

A third rule overrides everything. A table whose relfrozenxid is older than autovacuum_freeze_max_age (200 million transactions) is vacuumed even if autovacuum is switched off.11, 13

Autovacuum is polite. A session that requests a lock conflicting with the worker's SHARE UPDATE EXCLUSIVE lock cancels the worker, except when the worker is preventing wraparound. A job that repeatedly takes such locks on a table can therefore keep it from ever being vacuumed.11 PostgreSQL 19 adds a scoring system for the order in which tables are processed and lets autovacuum use parallel workers for indexes.5

4.4 Throttling: the cost model

Vacuum throttles itself with a simple budget. Each page found in shared buffers costs 1 (vacuum_cost_page_hit), each page read in costs 2 (vacuum_cost_page_miss), and each page dirtied costs 20 (vacuum_cost_page_dirty). When the total reaches vacuum_cost_limit (200), the process sleeps for the cost delay. A manual VACUUM has a delay of 0 and is not throttled. Autovacuum sleeps 2 ms (autovacuum_vacuum_cost_delay).13

The defaults work out to 500 sleeps a second and 100,000 cost units a second: at most about 5,000 dirtied pages, or 40 MB, per second. That budget is not per worker. It is balanced across all running workers, so raising autovacuum_max_workers alone divides the same I/O among more tables.11 A vacuum that cannot keep up needs a higher limit or a shorter delay, not more workers.

4.5 What holds the horizon back

Vacuum removes only versions older than the xmin horizon, and the horizon is a minimum over everything that might still need an old version: the snapshot xmin and XID of every backend, prepared transactions, the xmin and catalog_xmin of every replication slot, and the xmin reported by standbys running with hot_standby_feedback.35, 11, 36 When vacuum runs and removes nothing, one of these three queries usually says why:

SELECT pid, state, xact_start, age(backend_xmin) FROM pg_stat_activity
WHERE backend_xmin IS NOT NULL ORDER BY 4 DESC;
SELECT gid, prepared, age(transaction) FROM pg_prepared_xacts;
SELECT slot_name, active, age(xmin), age(catalog_xmin) FROM pg_replication_slots;

Both timeouts default to 0, which disables them.13 There is no longer a way to let vacuum overrule an old snapshot: the old_snapshot_threshold setting, which made such snapshots fail with "snapshot too old" instead, was removed in PostgreSQL 17 because of known correctness and performance problems.37, 33

4.6 Wraparound and freezing

XIDs are compared modulo 232, so every XID has about two billion older and two billion newer than itself. A version that sat unchanged for more than two billion transactions would flip from the past to the future and vanish from every snapshot. Freezing prevents that: vacuum marks the tuple frozen, which makes it older than every normal XID for good. Since 9.4 this is a flag in the header rather than an overwrite of xmin.11 Each table's pg_class.relfrozenxid records a lower bound on the unfrozen XIDs it contains, and the oldest of them determines how much of pg_xact must be kept.11

ThresholdSettingWhat happens
XID age 50 millionvacuum_freeze_min_agepages holding XIDs older than this are frozen when vacuum visits them
table age 150 millionvacuum_freeze_table_agethe next vacuum is aggressive: it visits every page not already all-frozen
table age 200 millionautovacuum_freeze_max_ageautovacuum is forced, even if disabled, and is not cancelled by lock requests
table age 1.6 billionvacuum_failsafe_agethe failsafe: no throttling, no index vacuuming
40 million XIDs leftfixed (100 million in 19)warnings to clients and in the log
3 million XIDs leftfixedthe server refuses to assign new XIDs; reads continue

The thresholds shown are the defaults, and "table age" means age(relfrozenxid).13, 11, 5 Ordinary vacuums skip all-visible pages, which may still hold unfrozen XIDs, so only an aggressive vacuum is guaranteed to advance relfrozenxid. The all-frozen bit, added to the visibility map in 2016 for this purpose, is what lets an aggressive vacuum skip pages instead of rereading the whole table.38 If the server does stop assigning XIDs, the manual's advice is to resolve old prepared transactions, end long-running ones, drop stale replication slots and then run a plain VACUUM: not VACUUM FULL, not VACUUM FREEZE, and not in single-user mode.11

MultiXact IDs age the same way, with their own settings (autovacuum_multixact_freeze_max_age defaults to 400 million) and one extra limit: the member storage wraps at about 20 GB, and autovacuum turns aggressive once it passes about 10 GB.11, 13 PostgreSQL 19 widens multixact members to 64 bits.5

4.7 Eager freezing and the failsafe

Freezing has a timing problem. Freeze a page too early and the work is wasted when the row changes again. Freeze too late and the debt lands on one aggressive vacuum that must read pages which "have often been evicted from shared buffers and even from the kernel buffer cache".39 Three changes moved the default towards paying earlier:

Section 5: The Write-Ahead Log

5.1 The one rule

Everything so far described changes to pages in memory. Durability comes from one rule: a change to a data file may be written only after the WAL record describing it has been flushed.42 The rule is enforced mechanically. Every page carries the LSN of the last record that touched it, and the buffer manager will not write a dirty page until the log is on disk at least that far.9 In return a commit has to force only the log, which is sequential, and "one fsync of the WAL file may suffice to commit many transactions".42

PostgreSQL's log is redo-only. After a crash, changes missing from the data files are replayed forward from the log.42 Nothing is ever rolled back, because the old versions are still in the heap and the versions written by a transaction that never committed are invisible by the rules of Section 2.

5.2 Records, LSNs and segments

A log sequence number is a byte offset into the WAL stream. It only grows, and subtracting two LSNs gives the amount of WAL between them, which is how replication lag is measured. The stream is stored under pg_wal in segment files of 16 MB with names such as 000000010000000000000001.42 A record starts with a fixed header: total length, the XID, a pointer to the previous record, flag bits, the ID of the resource manager that knows how to replay it, and a CRC-32C. Block references and payload follow.43, 42 Records are mostly physical: each holds "just enough information to redo a single incremental update on a page".9

5.3 Changing a page

Every WAL-logged change follows the same recipe: lock the buffer, enter a critical section, modify the page, mark it dirty, insert the WAL record, stamp the page with the record's LSN, leave the critical section. An error inside the critical section is escalated to a PANIC, since shared memory would otherwise hold a change the log knows nothing about.9

Because every writer inserts into the same log, insertion is built for concurrency. A backend first reserves its byte range in the stream under a briefly held lock, and then copies the record into the WAL buffers while holding one of eight insertion locks, so up to eight copies proceed in parallel.44 That design replaced a single insertion lock in 2013.45

5.4 The commit path

What COMMIT does, and in what order, explains most of PostgreSQL's durability settings. The sequence in RecordTransactionCommit() and its caller is:46

  step                                   state afterwards
  ------------------------------------   -----------------------------------------
  1  insert COMMIT record (LSN = c)      in WAL buffers; lost if the server crashes
  2  XLogFlush(c): write + fsync         durable; a crash now replays the commit
  3  set "committed" in pg_xact          hint bits may be set from here on
  4  wait for synchronous standbys       (only if synchronous_standby_names is set)
  5  remove XID from the running set     visible to snapshots taken from now on
  6  report success to the client

Steps 1 to 3 run inside a commit critical section that makes a concurrent checkpoint wait, so a checkpoint can never start after the commit record yet miss the pg_xact update. During step 4 the transaction has "marked clog, but still show[s] as running in the procarray" and still holds its locks: it is durable locally and invisible to everyone.46

Step 2 is where transactions meet. A backend that needs a flush either gets the WAL write lock or waits for whoever holds it, and on waking first checks whether its own LSN has already been flushed by that process. One fsync thus commits every transaction whose record reached the buffers before it started, which is group commit without any timer.44 commit_delay (default 0) makes the leader pause to gather more followers, but only when at least commit_siblings (5) other transactions are open.13

With synchronous_commit = off, step 2 is skipped: the backend notes its commit LSN and returns, and the WAL writer flushes within at most three times wal_writer_delay (200 ms).42, 13 A crash in that window loses the latest commits and nothing else; the database comes back exactly as if they had aborted. It can be chosen per transaction (SET LOCAL synchronous_commit = off) and is quite unlike fsync = off, which can corrupt the cluster.13, 42

5.5 Checkpoints

Without a bound, recovery would have to replay the log from the beginning. A checkpoint supplies the bound: it writes every dirty page to disk and then logs a checkpoint record, after which recovery need only start from that checkpoint's redo point and older segments can be recycled.42 A checkpoint begins every checkpoint_timeout (5 minutes) or when max_wal_size (1 GB, a soft limit) is about to be exceeded, and its writes are spread over checkpoint_completion_target (0.9) of the interval to avoid an I/O spike.42, 13 Frequent checkpoints shorten recovery; they also cost more I/O and, as the next section shows, more WAL.

5.6 Full-page writes and torn pages

An 8 kB page spans sixteen 512-byte sectors, and a power failure can leave some of them new and some old. A record that says "set this field on this page" cannot repair such a page. So the first change to each page after a checkpoint logs the whole page, and replay restores that image instead of applying a delta.42, 9 The test is one comparison: is the page's LSN older than the latest checkpoint's redo pointer?9

This is why WAL volume jumps after every checkpoint and why spacing checkpoints further apart reduces it. wal_compression (off by default; pglz, lz4 or zstd) compresses the images, and full_page_writes can be turned off only on storage that itself rules out partial page writes, such as ZFS.13, 42

5.7 Recovery, archiving and point-in-time recovery

Crash recovery reads pg_control to find the last checkpoint and replays forward from its redo point. For each record it compares LSNs: if the page's LSN is already at or past the record, the change is there and is skipped.42, 9 Replay is the only recovery code there is, and the same loop drives archive recovery and standbys.

Continuous archiving is the first reuse. Keep a base backup and every WAL segment since, and the cluster can be rebuilt as of any moment in between. The base backup need not be a consistent snapshot, because replay repairs it exactly as it repairs a crashed data directory.47

# primary: postgresql.conf (wal_level must be replica or logical)
archive_mode = on
archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'

# restore: unpack the base backup, create recovery.signal, then
restore_command = 'cp /mnt/server/archivedir/%f %p'
recovery_target_time = '2026-11-16 09:30:00+05:30'

The archive commands are the manual's own examples; the target can also be an LSN, an XID or a named restore point.47, 13 Only completed segments are archived, so archive_timeout bounds how stale the archive can be on a quiet server.13 Finishing an archive recovery starts a new timeline, whose ID forms the first eight hex digits of every segment name, so the WAL of the abandoned future is kept rather than overwritten.47

Section 6: Replication Is WAL Shipping

6.1 Physical streaming replication

A standby is a server that never leaves recovery. It starts from a base backup and keeps replaying the primary's WAL. Release 9.0 added the two features that made this practical: streaming replication, which sends WAL over a connection as it is generated instead of waiting for whole segments, and hot standby, which lets the replaying server answer read-only queries.48, 36 A walreceiver process on the standby connects to a walsender on the primary; shipping is asynchronous by default, with a lag that is typically under a second.36 Since the stream describes page changes, the copy is physical: it covers the whole cluster, and log shipping between different major versions is in general not possible.36

SELECT application_name, state, sync_state,
       sent_lsn, write_lsn, flush_lsn, replay_lsn, replay_lag
FROM pg_stat_replication;

6.2 Synchronous replication

Synchronous replication is step 4 of the commit path in Section 5.4. synchronous_standby_names selects who must answer, by priority (FIRST 2 (a, b, c)) or by quorum (ANY 2 (a, b, c)), and synchronous_commit selects what they must have done: remote_write (written to the standby's operating system), on (flushed to its disk) or remote_apply (replayed, so a query on the standby sees the row).13 All of the waiting logic lives on the primary; standbys only report positions and know nothing about which transactions depend on them.49

Two properties follow from where the wait sits. First, the commit is durable on the primary before the wait begins. If the wait is cancelled, the server warns that the transaction "has already committed locally, but might not have been replicated to the standby", and transactions caught waiting by a primary restart are committed when it recovers.49, 36 The guarantee is that a client is not told "committed" until a standby has the record, not that an unreplicated commit is undone. Second, if no eligible standby is connected, commits wait indefinitely, so a useful configuration names more candidates than it requires.36 PostgreSQL 19 adds a WAIT command with which a session on a standby waits until a given LSN has been replayed, giving read-your-writes without remote_apply.5

6.3 Hot standby and the cleanup conflict

A standby runs queries against snapshots it reconstructs from the WAL stream, by tracking which replayed transactions have not yet committed.9 The primary's cleanup knows nothing about those snapshots. It prunes versions that are dead on the primary and logs the cleanup; when that record reaches a standby where a query can still see those versions, either replay waits or the query is cancelled. The same conflict arises when vacuum marks a page all-visible.36

The settings choose who loses. max_standby_streaming_delay (30 s) is how long replay may be held up before conflicting queries are cancelled; raising it trades replication lag for query survival. hot_standby_feedback (off by default) makes the standby report its oldest snapshot so the primary keeps the rows, which removes the conflict and moves the bloat to the primary; the manual notes this is no worse than running the same queries on the primary.36, 13 Replication lag, cancelled queries or bloat on the primary: no setting avoids all three.

6.4 Replication slots

By default the primary recycles WAL at checkpoints whether or not a standby has received it, and a standby that falls too far behind must be rebuilt or fed from an archive. A replication slot fixes this by recording, on the primary, the oldest WAL and the oldest rows a consumer still needs, and it keeps protecting them while the consumer is disconnected.36

That persistence is the hazard. A slot knows nothing about whether its consumer still exists. One left behind by a decommissioned replica retains WAL until pg_wal fills the disk and pins the xmin horizon until, in the manual's words, the database may "shut down to prevent transaction ID wraparound".50, 36 Two limits exist, both off by default: max_slot_wal_keep_size invalidates a slot that holds back more WAL than the limit, and idle_replication_slot_timeout, new in 18, invalidates one that has been inactive too long.13, 4

SELECT slot_name, slot_type, active, wal_status,
       pg_size_pretty(pg_current_wal_lsn() - restart_lsn) AS retained_wal,
       age(xmin) AS xmin_age, age(catalog_xmin) AS catalog_xmin_age
FROM pg_replication_slots;

6.5 Logical decoding

Physical replication cannot copy one table, cross a major version, or feed another system. Logical decoding reads the same WAL and turns it back into row changes: an insert with the new row, and updates and deletes identified by the table's replica identity, by default its primary key.50, 51 It requires wal_level = logical, which adds the needed detail to the records.13

Two pieces of machinery do the work. WAL interleaves the records of concurrent transactions, so a reorder buffer collects changes per transaction and passes them to the output plugin only when it reads the commit record, spilling large transactions to disk beyond logical_decoding_work_mem (64 MB).52, 13 And decoding a tuple requires the table definition as it was when the record was written, so the decoder builds historic catalog snapshots from the WAL itself. This is what a logical slot's catalog_xmin is for: it stops vacuum from removing old catalog rows, while user-table rows can still be cleaned up.53

Delivery is at least once. A slot's position is persisted only at checkpoints, so after a crash recent changes are sent again and consumers must discard what they have already applied.50 Built-in logical replication is this mechanism with the pgoutput plugin, an initial table copy and apply workers on the subscriber. Schema changes are not replicated, and neither are sequences until PostgreSQL 19.51, 5

Section 7: Trade-offs — Versions in the Heap or in an Undo Log

7.1 The other way to do MVCC

InnoDB and Oracle make the opposite choice: the table holds only the newest version of a row, and the information needed to rebuild older ones goes to a separate undo log. In InnoDB each clustered-index record carries hidden system columns, among them a 6-byte transaction ID and a 7-byte "rollback data pointer" (DB_TRX_ID and DB_ROLL_PTR).54 Every new version of a record updates the roll pointer to point at "a new UNDO log entry that allows the old version to be reconstructed", and a reader whose read view may not see the current version fetches that undo record and builds the previous version from it, repeating until it reaches one it is entitled to see.55 A background purge removes undo records, and rows that were only marked deleted, once the oldest read view no longer needs them.55

So the same horizon exists in both designs; what differs is where the garbage piles up and who pays. Oracle shows a third answer to an old reader: if the undo it needs to build a consistent view has been overwritten, the query fails with ORA-01555, "snapshot too old".56 PostgreSQL had a comparable option until it was removed in 17 (Section 4.5); today the old reader always wins and the table bloats instead.

7.2 What each design pays for

PostgreSQL heapUndo-log engines
Old versions livein the table, beside live rowsin undo storage; the table holds the newest version
Updatea whole new tuple; no index writes only if HOT appliesin place, plus an undo record
Reading an old snapshotcosts the same as any read, but every scan steps over dead versionswalks the undo chain; cost grows with the age of the snapshot
Rollbacknothing to doundo must be applied to restore old versions
Garbage collectionvacuum visits tables and every indexpurge discards undo that no reader can need
A long-running readerbloats tables and indexesgrows the undo log, or (Oracle) the reader fails
Transaction ID in the row32 bits, hence freezing6 bytes in InnoDB; 64 bits in OrioleDB

The right-hand column draws on the InnoDB source, and on the zheap and OrioleDB design documents discussed next.54, 55, 57, 58 The pattern is consistent. PostgreSQL makes aborts, old readers and crash recovery cheap, and pays in space, index writes and a permanent background job. Undo-log engines keep tables compact and updates narrow, and pay on rollback, on long reads, and in a second structure that must itself be logged and purged.

7.3 Undo for PostgreSQL: zheap and OrioleDB

Two projects have tried to give PostgreSQL the other design. zheap, from EnterpriseDB, set out to control bloat with in-place updates and immediate reuse of space, to cut write amplification by allowing an update of an indexed column "without updating every index", and to shrink the tuple header. Each page has a few transaction slots that point into per-backend undo logs, and a rollback applies undo to restore the old tuples.57 The public repository's master branch has no commits after September 2019.59

OrioleDB is a storage engine delivered as an extension on the table access method interface. Its tables are index-organised B-trees on the primary key, and secondary indexes store primary-key values instead of physical addresses. Row versions form undo chains with the head on the data page and the rest in an undo log.60 Its README lists what follows from that: no dedicated vacuuming of tables, 64-bit transaction IDs, and row-level WAL made possible by copy-on-write checkpoints. The same README describes the project as a public beta that is "not recommended for production usage".58

Conclusion: Living With Versions

The mental model fits in a few sentences. A PostgreSQL table is a log of row versions that happens to be organised in pages. Readers decide what they see by comparing two XIDs in each tuple header with a snapshot. Cleanup is always safe to postpone and never free to skip. The WAL makes page changes durable, and everything else that looks like a separate feature (crash recovery, backups, standbys, logical replication) is another reader of that one stream.

The practical consequences follow from the mechanisms above:

The design is a poor fit for some workloads, and it is better to know them in advance: tables where most rows are rewritten continuously and many columns are indexed, queues that insert and delete at high rates while long reports run, and applications that cannot avoid hours-long transactions on a busy primary. Partitioning so that old data is dropped instead of deleted, moving long reads to a standby that accepts the lag, or choosing an engine built on undo are all reasonable answers. For most other workloads, the cost of keeping versions in the heap is a vacuum policy and a handful of alerts, and what it buys is readers that never wait.

Sources

  1. The Design of the POSTGRES Storage System (M. Stonebraker), Technical Report UCB/ERL M87/6 — EECS Department, University of California, Berkeley, seen in search results on 16 November 2026 (page not opened). https://www2.eecs.berkeley.edu/Pubs/TechRpts/1987/819.html
  2. Release notes for PostgreSQL 6.3, 6.5 and 7.1 (doc/src/sgml/release-old.sgml, REL9_3_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL9_3_STABLE/doc/src/sgml/release-old.sgml
  3. Concurrency Control (doc/src/sgml/mvcc.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/mvcc.sgml
  4. Release notes for PostgreSQL 18.0 to 18.7 (doc/src/sgml/release-18.sgml) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/release-18.sgml
  5. Release notes for PostgreSQL 19 (doc/src/sgml/release-19.sgml, REL_19_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_19_STABLE/doc/src/sgml/release-19.sgml
  6. Database Physical Storage: page layout, free space map, visibility map, heap-only tuples (doc/src/sgml/storage.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/storage.sgml
  7. src/include/access/htup_details.h: heap tuple header and infomask bits (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/include/access/htup_details.h
  8. pageinspect: low-level inspection of database pages (doc/src/sgml/pageinspect.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/pageinspect.sgml
  9. src/backend/access/transam/README: the transaction system, pg_xact, WAL coding rules, asynchronous commit (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/transam/README
  10. Transaction Processing (doc/src/sgml/xact.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/xact.sgml
  11. Routine Database Maintenance Tasks: vacuuming, wraparound, autovacuum (doc/src/sgml/maintenance.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/maintenance.sgml
  12. src/backend/access/heap/heapam_visibility.c: tuple visibility rules (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/heapam_visibility.c
  13. Server Configuration (doc/src/sgml/config.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/config.sgml
  14. src/backend/access/heap/README.tuplock: locking tuples (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/README.tuplock
  15. src/include/utils/snapshot.h: SnapshotData (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/include/utils/snapshot.h
  16. Functions and Operators: transaction ID and snapshot information functions (doc/src/sgml/func.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/func.sgml
  17. Commit dc7420c2c9: snapshot scalability: Don't compute global horizons while building snapshots (A. Freund, August 2020) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/dc7420c2c9274a283779ec19718d2d16323640c0
  18. src/backend/storage/lmgr/README-SSI: Serializable Snapshot Isolation and predicate locking (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/storage/lmgr/README-SSI
  19. Serializable Snapshot Isolation in PostgreSQL (D. R. K. Ports, K. Grittner), PVLDB 5(12), 2012 — arXiv, seen in search results on 16 November 2026 (page not opened). https://arxiv.org/abs/1208.4179
  20. src/include/storage/proc.h: PGPROC and the subtransaction XID cache (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/include/storage/proc.h
  21. Why we spent the last month eliminating PostgreSQL subtransactions (29 September 2021) — GitLab blog, seen in search results on 16 November 2026 (page not opened). https://about.gitlab.com/blog/why-we-spent-the-last-month-eliminating-postgresql-subtransactions/
  22. src/backend/access/heap/README.HOT: heap-only tuples (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/README.HOT
  23. Release notes for PostgreSQL 8.3 (doc/src/sgml/release-8.3.sgml, REL9_3_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL9_3_STABLE/doc/src/sgml/release-8.3.sgml
  24. src/backend/access/heap/pruneheap.c: heap page pruning and HOT-chain management (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/pruneheap.c
  25. CREATE TABLE: storage parameters (doc/src/sgml/ref/create_table.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/ref/create_table.sgml
  26. src/backend/access/nbtree/README: B-tree index implementation notes (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/nbtree/README
  27. Commit d168b66682: Enhance nbtree index tuple deletion (P. Geoghegan, January 2021) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/d168b666823b6e0bcf60ed19ce24fb5fb91b8ccf
  28. Release notes for PostgreSQL 14 (doc/src/sgml/release-14.sgml, REL_14_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_14_STABLE/doc/src/sgml/release-14.sgml
  29. Indexes: index-only scans and covering indexes (doc/src/sgml/indices.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/indices.sgml
  30. src/backend/access/heap/visibilitymap.c: the visibility map (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/visibilitymap.c
  31. src/backend/access/heap/vacuumlazy.c: concurrent ("lazy") vacuuming (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/heap/vacuumlazy.c
  32. Commit 667e65aac3: Use TidStore for dead tuple TIDs storage during lazy vacuum (M. Sawada, April 2024) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/667e65aac354975c6f8090c6146fceb8d7b762d6
  33. Release notes for PostgreSQL 17 (doc/src/sgml/release-17.sgml, REL_17_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_17_STABLE/doc/src/sgml/release-17.sgml
  34. Commit 5100010ee4: Teach VACUUM to bypass unnecessary index vacuuming (P. Geoghegan, April 2021) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/5100010ee4d5c8ef46619dbd1d17090c627e6d0a
  35. src/backend/storage/ipc/procarray.c: the process array and XID horizons (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/storage/ipc/procarray.c
  36. High Availability, Load Balancing, and Replication (doc/src/sgml/high-availability.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/high-availability.sgml
  37. Commit f691f5b80a: Remove the "snapshot too old" feature (T. Munro, September 2023) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/f691f5b80a85c66d715b4340ffabb503eb19393e
  38. Commit a892234f83: Change the format of the VM fork to add a second bit per page (R. Haas, March 2016) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/a892234f830e832110f63fc0a2afce2fb21d1584
  39. Commit 052026c9b9: Eagerly scan all-visible pages to amortize aggressive vacuum (M. Plageman, February 2025) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/052026c9b903380b428a4c9ba2ec90726db81288
  40. Commit 1de58df4fe: Add page-level freezing to VACUUM (P. Geoghegan, December 2022) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/1de58df4fec7325d91f5a8345757314be7ac05da
  41. Commit 1e55e7d175: Add wraparound failsafe to VACUUM (P. Geoghegan, April 2021) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/1e55e7d1755cefbb44982fbacc7da461fa8684e6
  42. Reliability and the Write-Ahead Log (doc/src/sgml/wal.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/wal.sgml
  43. src/include/access/xlogrecord.h: WAL record format (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/include/access/xlogrecord.h
  44. src/backend/access/transam/xlog.c: the write-ahead log manager (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/transam/xlog.c
  45. Commit 9a20a9b21b: Improve scalability of WAL insertions (H. Linnakangas, July 2013) — postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/commit/9a20a9b21baa819df1760b36f3c36f25d11fc27b
  46. src/backend/access/transam/xact.c: top-level transaction system (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/access/transam/xact.c
  47. Backup and Restore: continuous archiving and point-in-time recovery (doc/src/sgml/backup.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/backup.sgml
  48. Release notes for PostgreSQL 9.0 (doc/src/sgml/release-9.0.sgml, REL9_3_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL9_3_STABLE/doc/src/sgml/release-9.0.sgml
  49. src/backend/replication/syncrep.c: synchronous replication (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/replication/syncrep.c
  50. Logical Decoding (doc/src/sgml/logicaldecoding.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/logicaldecoding.sgml
  51. Logical Replication (doc/src/sgml/logical-replication.sgml), PostgreSQL 18 documentation source — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/logical-replication.sgml
  52. src/backend/replication/logical/reorderbuffer.c: logical replay/reorder buffer (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/replication/logical/reorderbuffer.c
  53. src/backend/replication/logical/snapbuild.c: historic catalog snapshots for decoding (REL_18_STABLE) — PostgreSQL Global Development Group, postgres/postgres on GitHub, accessed 16 November 2026. https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/replication/logical/snapbuild.c
  54. storage/innobase/include/data0type.h: InnoDB system column types and lengths (mysql-server, trunk) — Oracle Corporation, mysql/mysql-server on GitHub, accessed 16 November 2026. https://github.com/mysql/mysql-server/blob/trunk/storage/innobase/include/data0type.h
  55. storage/innobase/read/read0read.cc: InnoDB read views and purge (mysql-server, trunk) — Oracle Corporation, mysql/mysql-server on GitHub, accessed 16 November 2026. https://github.com/mysql/mysql-server/blob/trunk/storage/innobase/read/read0read.cc
  56. ORA-01555 "Snapshot too old" - Detailed Explanation (Doc ID 40689.1) — My Oracle Support, Oracle Corporation, seen in search results on 16 November 2026 (page not opened). https://support.oracle.com/knowledge/Oracle%20Database%20Products/40689_1.html
  57. src/backend/access/zheap/README: zheap design — EnterpriseDB/zheap on GitHub, accessed 16 November 2026. https://github.com/EnterpriseDB/zheap/blob/master/src/backend/access/zheap/README
  58. OrioleDB: a cloud-native storage engine for PostgreSQL (README.md) — orioledb/orioledb on GitHub, accessed 16 November 2026. https://github.com/orioledb/orioledb/blob/main/README.md
  59. Commit history of the zheap master branch — EnterpriseDB/zheap on GitHub, accessed 16 November 2026. https://github.com/EnterpriseDB/zheap/commits/master
  60. OrioleDB architecture overview (doc/architecture/overview.mdx) — orioledb/orioledb on GitHub, accessed 16 November 2026. https://github.com/orioledb/orioledb/blob/main/doc/architecture/overview.mdx