{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59", "published": "2026-10-19T06:36:20Z", "publisher": "PostgresAI", "article": {"title": "How we stopped xmin horizon blocking Postgres vacuuming: a deepdive", "url": "https://trigger.dev/blog/stopping-xmin-horizon-blocking-postgres-vacuuming", "date_published": "2024-08-16T00:00:00Z", "author": "Matt Aitken", "publisher": "Trigger.dev"}, "grade": "A", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 18 checked \u00b7 1 caveat"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 6 checked \u00b7 1 caveat"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 18 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 8 checked \u00b7 0 caveats"}, {"axis": "Safe", "summary": "B+ \u00b7 0 wrong of 5 checked \u00b7 0 caveats \u00b7 1 unwarned risk"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F1", "claim": "\u2026The `oldest xmin` is the transaction ID of the oldest transaction that's still running.", "title": "The cleanup horizon is not just the oldest running transaction ID", "explanation": "VACUUM uses a cleanup horizon derived from transaction IDs, snapshot xmin values, and replication slots. procarray.c:1805-1811 compares xmin with xid. Lines 1896-1902 incorporate slot xmin. REL_16_4 does the same. Searching only running transaction IDs can miss the holder.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/procarray.c#L1896-L1902", "label": "REL_18_6 \u00b7 src/backend/storage/ipc/procarray.c:1896-1902"}, {"url": "https://github.com/postgres/postgres/blob/2caa85f4aae689e6f6721d7363b4c66a2a6417d6/src/backend/storage/ipc/procarray.c#L1892-L1898", "label": "REL_16_4 \u00b7 src/backend/storage/ipc/procarray.c:1892-1898"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/procarray.c#L1800-L1935", "label": "REL_18_6 \u00b7 src/backend/storage/ipc/procarray.c:1800-1935"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F2", "claim": "A dead tuple is a row that has been deleted but not yet vacuumed.", "title": "UPDATE also produces dead tuples", "explanation": "Dead tuples include obsolete row versions from UPDATE, not only deleted rows. pgstat_relation.c:582-584 counts both operations as dead-tuple producers. REL_16_4 maintenance.sgml:156-158 documents both. Restricting monitoring to deletion-heavy tables misses update-generated dead versions.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/activity/pgstat_relation.c#L576-L588", "label": "REL_18_6 \u00b7 src/backend/utils/activity/pgstat_relation.c:576-588"}, {"url": "https://github.com/postgres/postgres/blob/2caa85f4aae689e6f6721d7363b4c66a2a6417d6/doc/src/sgml/maintenance.sgml#L156-L165", "label": "REL_16_4 \u00b7 doc/src/sgml/maintenance.sgml:156-165"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F3", "claim": "\u2026You can run this query to see how many [dead tuples]\u2026", "title": "pg_stat_user_tables provides dead-row estimates", "explanation": "pg_stat_user_tables exposes estimated live and dead row counts for user tables. system_views.sql:696-697 selects those counters. monitoring.sgml:3961-3964 identifies n_dead_tup as an estimate. The displayed percentages and ordering provide useful diagnostics.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L691-L704", "label": "REL_18_6 \u00b7 src/backend/catalog/system_views.sql:691-704"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L724-L754", "label": "REL_18_6 \u00b7 src/backend/catalog/system_views.sql:724-754"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/monitoring.sgml#L3948-L3967", "label": "REL_18_6 \u00b7 doc/src/sgml/monitoring.sgml:3948-3967"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F4", "claim": "\u2026pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS external_size,\u2026", "title": "The size expression subtracts the main relation fork from total storage", "explanation": "pg_total_relation_size includes table storage, indexes, and TOAST. One-argument pg_relation_size measures the main fork. Their difference includes indexes, TOAST, and auxiliary forks. pg_size_pretty formats the resulting byte count. dbsize.c and pg_proc.dat implement these operations.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L30273-L30277", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:30273-30277"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L30159-L30164", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:30159-30164"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L30209-L30227", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:30209-30227"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/dbsize.c#L537-L607", "label": "REL_18_6 \u00b7 src/backend/utils/adt/dbsize.c:537-607"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/catalog/pg_proc.dat#L7743-L7747", "label": "REL_18_6 \u00b7 src/include/catalog/pg_proc.dat:7743-7747"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/dbsize.c#L537-L607", "label": "REL_18_6 \u00b7 src/backend/utils/adt/dbsize.c:537-607"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F5", "claim": "We manually cancelled these transactions using `pg_cancel_backend`\u2026", "title": "pg_cancel_backend targets the executing query", "explanation": "pg_cancel_backend sends SIGINT to the selected backend. func.sgml:28688-28689 specifies current-query cancellation. signalfuncs.c:138 implements that signal. This fits an attempt to cancel executing upserts. It does not establish that their sessions terminated.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L28687-L28690", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:28687-28690"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/signalfuncs.c#L134-L139", "label": "REL_18_6 \u00b7 src/backend/storage/ipc/signalfuncs.c:134-139"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F6", "claim": "Terminating long-running transactions using `pg_terminate_backend()`\u2026", "explanation": "pg_terminate_backend targets the selected session. doc/src/sgml/func.sgml:28766-28767 documents session termination. src/backend/storage/ipc/signalfuncs.c:251 sends SIGTERM. These citations establish the termination mechanism. They do not establish its effect on the cleanup horizon.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L28766-L28769", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:28766-28769"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/signalfuncs.c#L235-L253", "label": "REL_18_6 \u00b7 src/backend/storage/ipc/signalfuncs.c:235-253"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F7", "claim": "`hot_standby_feedback = off`\u2026", "title": "Disabling standby feedback can release its reported horizons", "explanation": "hot_standby_feedback can retain primary row versions. walreceiver.c:1286-1294 obtains replication horizons when enabled and reports invalid horizons when disabled. Disabling it addresses this retention mechanism. It does not remove unrelated transaction or replication-slot constraints.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L5235-L5245", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:5235-5245"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/replication/walreceiver.c#L1283-L1297", "label": "REL_18_6 \u00b7 src/backend/replication/walreceiver.c:1283-1297"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F8", "claim": "Dead tuples matter when you do a sequential scan because Postgres has to skip over them\u2026", "title": "Sequential scans skip invisible row versions", "explanation": "Heap scans inspect tuple visibility and skip versions invisible to their snapshot. heapam.c:955-965 performs the visibility test and skip. Retained versions consume storage that scans traverse. This supports the stated scan-cost mechanism.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L920-L972", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:920-972"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F9", "claim": "Graphile Worker is a job queue built on Postgres\u2026", "title": "Graphile Worker uses PostgreSQL for its job queue", "explanation": "Graphile Worker's official home page describes jobs built on PostgreSQL transactions. That supports the article's product definition. It does not verify the incident's job-selection plans.", "verdict": "Accurate", "sources": [{"url": "https://worker.graphile.org/", "label": "https://worker.graphile.org/"}, {"url": "https://worker.graphile.org/", "label": "https://worker.graphile.org/"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F10", "claim": "Unused replication slots\u2026", "title": "Replication slots belong in a cleanup-horizon investigation", "explanation": "Replication slots can require an older cleanup horizon. procarray.c:1896-1902 incorporates slot xmin into data and shared horizons. REL_16_4 implements the same check. Investigating relevant slot xmin values fits this diagnosis.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/ipc/procarray.c#L1896-L1902", "label": "REL_18_6 \u00b7 src/backend/storage/ipc/procarray.c:1896-1902"}, {"url": "https://github.com/postgres/postgres/blob/2caa85f4aae689e6f6721d7363b4c66a2a6417d6/src/backend/storage/ipc/procarray.c#L1892-L1898", "label": "REL_16_4 \u00b7 src/backend/storage/ipc/procarray.c:1892-1898"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F11", "claim": "Uncomitted PREPARED transactions\u2026", "title": "Prepared transactions remain relevant to cleanup horizons", "explanation": "Prepared transactions retain a dummy PGPROC that keeps their transaction ID considered running. twophase.c:24-26 documents that representation. Checking unresolved prepared transactions fits a retained-horizon investigation.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/transam/twophase.c#L21-L27", "label": "REL_18_6 \u00b7 src/backend/access/transam/twophase.c:21-27"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F12", "claim": "Was vacuuming getting terminated early?", "title": "Repeated interruption can prevent autovacuum completion", "explanation": "Conflicting lock requests can interrupt ordinary autovacuum workers. maintenance.sgml:1032-1034 warns that repeated conflicting commands can prevent completion. Checking interrupted vacuum runs fits the article's diagnostic checklist.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/maintenance.sgml#L1010-L1040", "label": "REL_18_6 \u00b7 doc/src/sgml/maintenance.sgml:1010-1040"}]}, {"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F13", "claim": "Postgres should be auto-vacuuming these tables regularly.", "title": "Periodic autovacuum is the documented expectation", "explanation": "PostgreSQL documents periodic vacuuming and ordinary use of autovacuum in doc/src/sgml/maintenance.sgml:70. It also warns that installations may require parameter changes. The article's expectation does not establish that cleanup succeeded.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/maintenance.sgml#L60-L78", "label": "REL_18_6 \u00b7 doc/src/sgml/maintenance.sgml:60-78"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F14", "claim": "\u2026Adding `VERBOSE` gives you useful output like this\u2026", "title": "VACUUM VERBOSE produces detailed diagnostics", "explanation": "VACUUM VERBOSE prints a detailed activity report for each table at INFO level. PostgreSQL 18.6 documents this in doc/src/sgml/ref/vacuum.sgml:132.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/vacuum.sgml#L129-L137", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/vacuum.sgml:129-137"}]}, {"anchor": "F15", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F15", "claim": "\u2026have separate concurrency for each of your users\u2026", "title": "Separate per-user concurrency remains supported", "explanation": "Trigger.dev documents separate concurrencyKey pools. Assigning different users different keys supports the capability the article describes.", "verdict": "Accurate", "sources": [{"url": "https://trigger.dev/docs/queue-concurrency", "label": "https://trigger.dev/docs/queue-concurrency"}]}, {"anchor": "F16", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F16", "claim": "It also provides proactive advice on config, queries and indexes.", "title": "pganalyze documents configuration, query, and index advice", "explanation": "pganalyze documents automated configuration checks, query tuning recommendations, and Index Advisor recommendations. These support the article's feature description.", "verdict": "Accurate", "sources": [{"url": "https://pganalyze.com/", "label": "https://pganalyze.com/"}, {"url": "https://pganalyze.com/", "label": "https://pganalyze.com/"}, {"url": "https://pganalyze.com/", "label": "https://pganalyze.com/"}]}, {"anchor": "F17", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F17", "claim": "\u2026199 pages from table (1.15% of total)\u2026", "title": "The 1.15% page fraction rounds correctly", "explanation": "199 of 17,272 table pages is 1.15% after rounding (derived: 199 / 17,272 \u00d7 100).", "verdict": "Accurate", "sources": []}, {"anchor": "F18", "url": "https://pgtrue.postgres.ai/shared/brief/072fd433-ce8e-46d3-bd95-4330c40daa59#F18", "claim": "\u202617202 out of 17272 pages\u2026", "title": "Scanned and skipped pages equal the table total", "explanation": "17,202 scanned pages plus 70 skipped pages equals 17,272 total pages. The page counts contain no arithmetic discrepancy.", "verdict": "Accurate", "sources": []}]}