← Fri, Nov 20 digest

Postgres 19 Repack: Faster, Built-In Table Bloat Cleanup

read article ↗ hn thread ↗

Postgres 19 introduces native REPACK (CONCURRENTLY) to clean up table bloat and reorder data online without third-party extensions.

read it Essential reading for database administrators evaluating Postgres 19 features, with clear command examples, performance tradeoffs, and operational requirements.

summary

Postgres 19 adds a built-in REPACK (CONCURRENTLY) command to resolve table bloat online without third-party extensions. The mechanism uses logical decoding to capture concurrent writes, requiring an exclusive lock only during the final file swap. While it simplifies maintenance, it demands double the table size in disk space and currently lacks support for partitioned tables.

key points

  1. REPACK (CONCURRENTLY) lets tables stay readable and writable during maintenance, locking only briefly at completion.
  2. The optional USING INDEX clause physically reorders rows to match an index, speeding up range queries.
  3. Operations require twice the table's current size in free disk space and do not yet support partitioned tables.

who should read it

Database administrators and backend engineers running high-churn Postgres production instances.

discussion warm

consensus

Commenters welcome the native functionality over third-party extensions like pg_repack, though many note practical limitations like missing partition support.

pushback

Critics warn that requiring twice the table size in free space is a dangerous foot-gun for large databases.

best comment by QuentinM ↗

I would have loved REPACK CONCURRENTLY when we were generating millions of dead tuples an hour on our trading database …

Sadly it doesn’t support partitions yet, which is typical when reaching sufficient scale that bloat management really matters. People often mention disk space when talking about dead tuples, but the real killer is what’s hidden under - bloat in the ctid & btree leaf linked lists make every lookup feel like table scans…!

Thankfully HOT (Heap-only Tuples) has saved us since. Virtually no dead tulles generated, and they get otherwise collected during regular ops like SELECT, …

Explains why the current lack of partition support restricts adoption for massive databases where bloat matters most.

Generated by an LLM from the article and thread. Check the sources before relying on it.