Postgres 19 REPACK (CONCURRENTLY): RIP pg_repack?

Postgres 19 REPACK (CONCURRENTLY): RIP pg_repack?

Nik and Kirk discuss REPACK (CONCURRENTLY) in Postgres 19: benchmarks against pg_repack and pg_squeeze, the final ACCESS EXCLUSIVE swap, lock_timeout vs autovacuum, and when to use which tool today.

👉 Give your AI agent PostgresAI: npx pgai skills

Tip: watch the video version on YouTube: it has the charts from our DBLab Forge study and animations of every mechanism we talk about.

Episode description

Nik and Kirk discuss REPACK (CONCURRENTLY), the new way in Postgres 19 to remove table bloat without long locks: how we got here (pgcompacttable, VACUUM FULL, pg_repack, pg_squeeze), why "concurrently" here does not mean what it means for REINDEX CONCURRENTLY, and what our DBLab Forge experiments showed. The final file swap still needs an ACCESS EXCLUSIVE lock: at 2,000 TPS with the default lock_timeout = 0, one 60-second SELECT froze all reads and writes for 57 s. Then lock_timeout with one attempt vs pg_repack's retry loop, autovacuum, the MVCC caveat, and when to use which tool today.

Links

Here are some links to things they mentioned:

Main link

REPACK and its history

Locks and settings

Testing

Episodes we referred to

Corrections

Checked after recording against the DBLab Forge study and the Postgres 19 docs:

  • [17:20] Case T1 is a 13.02 GiB table, not "20-something" GB.
  • [17:53] The red area on the T1 chart is a 6.04 s lock wait span, with 5 s at 0 TPS (not "seven seconds").
  • [24:19] The 901.2 GiB run (Case T2: 5.32 h, exploratory, unverified) used a 4 TB network volume (141.9 MiB/s), not local NVMe.
  • [34:06] The setting is max_slot_wal_keep_size.
  • [34:49] Postgres 19 already has the pg_stat_progress_repack view. It does not show the decoded changes spilled to temporary files: in our edge test, pg_ls_tmpdir() returned 0 rows during the spill.

Some kind things our listeners have said