← All notes

PostgreSQL VACUUM and MVCC: why dead rows pile up

Short answer

PostgreSQL uses MVCC (multiversion concurrency control): an UPDATE or DELETE leaves the old row version in place so other transactions can still see it. VACUUM cleans them. [S1][S2]

What VACUUM does

If you have a table whose entire contents are deleted on a periodic basis, consider doing it with TRUNCATE rather than using DELETE followed by VACUUM. (S1)

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: 24.1. Routine Vacuuming, PostgreSQL License; PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: 13.1. Introduction, PostgreSQL License.

Cite this

Permanent ID: iil:note:ewke3cyc

iinventedlight. 2026. "PostgreSQL VACUUM and MVCC: why dead rows pile up." iinventedlight Library, iil:note:ewke3cyc, version of 2026-11-04. https://iinventedlight.com/library/notes/postgres-vacuum-mvcc/. License: CC-BY-4.0.

@misc{iil_note_ewke3cyc,
  author = {{iinventedlight}},
  title = {{PostgreSQL VACUUM and MVCC: why dead rows pile up}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/postgres-vacuum-mvcc/},
  note = {Permanent ID iil:note:ewke3cyc. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/postgres-vacuum-mvcc.md.