[PATCH] doc: explain database-wide impact of old xmin on VACUUM

First seen: 2026-06-01 06:10:51+00:00 · Messages: 1 · Participants: 1

Latest Update

2026-06-04 · claude-opus-4-6

Technical Analysis: [PATCH] doc: explain database-wide impact of old xmin on VACUUM

Core Problem

This thread addresses a documentation gap in PostgreSQL regarding how a single old transaction's xmin horizon can impact VACUUM effectiveness across an entire database, not just the table(s) that the transaction has touched.

Why This Matters Architecturally

PostgreSQL's MVCC implementation relies on transaction IDs (XIDs) to determine tuple visibility. VACUUM reclaims dead tuples that are no longer visible to any active transaction. The critical architectural detail is that the xmin horizon — the oldest transaction ID that any running transaction might still need to see — is computed globally (at the database level, and in some cases cluster-wide for shared catalogs).

This means:

The Visibility/Horizon Mechanism

The xmin horizon is determined by:

  1. The oldest running transaction's XID (oldestXmin)
  2. Replication slot xmin and catalog_xmin values
  3. Prepared (2PC) transactions
  4. Hot standby feedback from replicas

When VACUUM processes a table, it cannot remove any tuple version whose xmax (deletion XID) is >= this global horizon, regardless of whether the transaction holding the horizon open ever touched that specific table.

Proposed Solution

The patch is a documentation improvement that explicitly explains:

  1. That a single old xmin affects VACUUM's ability to clean up dead tuples database-wide
  2. The mechanisms by which old xmin values persist (long transactions, replication slots, prepared transactions)
  3. The practical consequences for table bloat

This is a "doc-only" patch — no code changes — aimed at improving user understanding of a frequently misunderstood architectural behavior.

Key Technical Insights

The database-wide nature of the xmin horizon is a fundamental consequence of PostgreSQL's MVCC design:

Assessment

This is a straightforward documentation patch addressing a well-known operational pain point. The technical content it documents is uncontroversial — the behavior is well-established. The main review questions would be:

Given that this is a single-message thread (initial submission), no review feedback has been provided yet.