{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98", "published": "2026-10-21T04:06:52Z", "publisher": "PostgresAI", "article": {"title": "What deleting rows does to a PostgreSQL table", "url": "https://explainmeasured.com/posts/deleting-rows", "date_published": "2026-10-13T00:00:00Z", "author": "Hollis Varden", "publisher": "explainmeasured.com"}, "grade": "B", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 15 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 11 checked \u00b7 0 caveats"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 15 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "C \u00b7 0 wrong of 10 checked \u00b7 0 caveats \u00b7 reproducibility: C (no code or raw results)"}, {"axis": "Safe", "summary": "not applicable"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F1", "claim": "VACUUM makes their space reusable\u2026", "title": "Ordinary VACUUM makes dead-row storage reusable", "explanation": "PostgreSQL 18.6 records free heap-page space after vacuuming. Ordinary VACUUM can also truncate empty trailing pages. The documentation requires an obtainable exclusive lock for truncation. The article distinguishes reuse from returning storage to the operating system.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/maintenance.sgml#L169-L174", "label": "REL_18_6 \u00b7 doc/src/sgml/maintenance.sgml:169-174"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/vacuumlazy.c#L2809-L2815", "label": "REL_18_6 \u00b7 src/backend/access/heap/vacuumlazy.c:2809-2815"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/vacuumlazy.c#L3305-L3330", "label": "REL_18_6 \u00b7 src/backend/access/heap/vacuumlazy.c:3305-3330"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F2", "claim": "VACUUM FULL writes a new copy of the table and drops the old one.", "title": "VACUUM FULL rewrites storage under ACCESS EXCLUSIVE", "explanation": "PostgreSQL 18.6 copies heap data, swaps physical files, rebuilds indexes, and removes the transient relation. vacuum.c selects ACCESS EXCLUSIVE for VACUUM FULL. The article correctly states that the operation blocks reads and writes.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/cluster.c#L655-L693", "label": "REL_18_6 \u00b7 src/backend/commands/cluster.c:655-693"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/vacuum.c#L2092-L2093", "label": "REL_18_6 \u00b7 src/backend/commands/vacuum.c:2092-2093"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F3", "claim": "TRUNCATE is not a drop-in replacement.", "title": "The TRUNCATE caveats match PostgreSQL 18.6", "explanation": "TRUNCATE acquires ACCESS EXCLUSIVE and does not fire ON DELETE triggers. Referencing tables must join the same command, directly or through CASCADE. PostgreSQL 18.6 documents each distinction the article lists.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/truncate.sgml#L120-L126", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/truncate.sgml:120-126"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/truncate.sgml#L133-L135", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/truncate.sgml:133-135"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/tablecmds.c#L1885-L1915", "label": "REL_18_6 \u00b7 src/backend/commands/tablecmds.c:1885-1915"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F4", "claim": "\u2026The DELETE marks rows dead.", "title": "DELETE marks tuple versions and logs heap deletions", "explanation": "PostgreSQL 18.6 records deletion transaction information in each deleted tuple version. heapam.c emits XLOG_HEAP_DELETE for logged relations. The article's description matches its logged-table benchmark.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L3117-L3137", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:3117-3137"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L3204-L3204", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:3204-3204"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F6", "claim": "If the new version fits on the same page and no indexed column changed\u2026", "explanation": "PostgreSQL 18.6 creates another row version for UPDATE. heapam.c permits HOT when that version occupies the original page and no HOT-blocking indexed attributes change. The article's stronger unchanged-index condition is sufficient. Its benchmark uses ordinary indexes and updates an unindexed column.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L4116-L4125", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:4116-4125"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/storage.sgml#L1085-L1086", "label": "REL_18_6 \u00b7 doc/src/sgml/storage.sgml:1085-1086"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F8", "claim": "\u2026each on a freshly built table\u2026", "explanation": "run2.py rebuilds tables for the timed DELETE and TRUNCATE trials. Section 6 measures pg_table_size after each maintenance step. Section 11 creates 200,000 rows with fillfactor 100 or 90 and indexes id and k. Its updates change v. We checked the procedures, without reproducing their measurements.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F12", "claim": "\u2026it refuses to run on a table that other tables reference with foreign keys\u2026", "explanation": "TRUNCATE requires referencing tables in the same command. PostgreSQL documents this at doc/src/sgml/ref/truncate.sgml:120. The article correctly identifies the restriction.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/truncate.sgml#L120-L126", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/truncate.sgml:120-126"}, {"url": "https://github.com/postgres/postgres/blob/48b43081e550f9e4b04e1184ed6d3fed4f850691/doc/src/sgml/ref/truncate.sgml#L120-L122", "label": "REL_19_STABLE@48b43081e5 \u00b7 doc/src/sgml/ref/truncate.sgml:120-122"}]}, {"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F13", "claim": "\u2026the new REPACK command in PostgreSQL 19 as alternatives to VACUUM FULL\u2026", "title": "PostgreSQL 19 introduces REPACK", "explanation": "PostgreSQL 19 introduces REPACK as a replacement for VACUUM FULL and CLUSTER. Its release notes confirm this at doc/src/sgml/release-19.sgml:1755.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/48b43081e550f9e4b04e1184ed6d3fed4f850691/doc/src/sgml/release-19.sgml#L1755-L1755", "label": "REL_19_STABLE@48b43081e5 \u00b7 doc/src/sgml/release-19.sgml:1755-1755"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F14", "claim": "\u2026empty pages at the very end of the file get cut off\u2026", "explanation": "Ordinary VACUUM can return empty trailing pages when it obtains the required exclusive lock. PostgreSQL documents this at doc/src/sgml/maintenance.sgml:169. The article states this exception.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/maintenance.sgml#L169-L174", "label": "REL_18_6 \u00b7 doc/src/sgml/maintenance.sgml:169-174"}, {"url": "https://github.com/postgres/postgres/blob/48b43081e550f9e4b04e1184ed6d3fed4f850691/doc/src/sgml/maintenance.sgml#L169-L174", "label": "REL_19_STABLE@48b43081e5 \u00b7 doc/src/sgml/maintenance.sgml:169-174"}]}, {"anchor": "F16", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F16", "claim": "\u2026137 MB after VACUUM, and 68 MB after VACUUM FULL.", "title": "DELETE and VACUUM sizes match the recorded byte counts", "explanation": "The results record 136,912,896 bytes before deletion, after deletion, and after VACUUM. VACUUM FULL leaves 68,280,320 bytes. These round to 137 MB and 68 MB. Section 6 creates 2,000,000 sequential IDs and deletes the even IDs.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F17", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F17", "claim": "\u2026DELETE FROM d1 (1M rows) 3.5 s 125 MB\u2026", "title": "DELETE timing and WAL values round correctly", "explanation": "The linked results give median elapsed time of 3.484 seconds and median WAL generation of 125,043,768 bytes. These round to 3.5 seconds and 125 MB. The timer includes the psql call.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F18", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F18", "claim": "\u2026TRUNCATE d1 0.05 s 44 kB\u2026", "title": "TRUNCATE timing and WAL values round correctly", "explanation": "The linked results give median elapsed time of 0.047 seconds and median WAL generation of 44,480 bytes. These round to 0.05 seconds and 44 kB.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}, {"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F19", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F19", "claim": "\u2026fillfactor 100 64 of 600,000 61 MB 10.4 MB\u2026", "title": "Fillfactor 100 counters and sizes match the results", "explanation": "The results record 64 HOT updates among 600,000 updates. The final table contains 61,300,736 bytes. The k index contains 10,354,688 bytes. Those sizes round to 61 MB and 10.4 MB.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F20", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F20", "claim": "\u2026fillfactor 90 127,353 of 600,000 47 MB 9.0 MB\u2026", "title": "Fillfactor 90 counters and sizes match the results", "explanation": "The results record 127,353 HOT updates among 600,000 updates. The final table contains 46,604,288 bytes. The k index contains 9,003,008 bytes. Those sizes round to 47 MB and 9.0 MB.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}, {"url": "https://explainmeasured.com/posts/deleting-rows/run2.py", "label": "https://explainmeasured.com/posts/deleting-rows/run2.py"}]}, {"anchor": "F21", "url": "https://pgtrue.postgres.ai/shared/brief/7970ccc5-4405-4c5a-95d6-5d77dc9eee98#F21", "claim": "\u2026about a fifth of the updates did, and the table ended 24% smaller.", "title": "The HOT share and 24% storage reduction follow from the results", "explanation": "HOT updates account for 21.2% of 600,000 updates at fillfactor 90 (derived: 127,353 / 600,000). The table shrinks 24.0% against fillfactor 100 (derived: 1 \u2212 46,604,288 / 61,300,736). Both descriptions match the recorded measurements.", "verdict": "Accurate", "sources": [{"url": "https://explainmeasured.com/posts/deleting-rows/results2.json", "label": "https://explainmeasured.com/posts/deleting-rows/results2.json"}]}]}