PostgreSQL 19 adds REPACK command with CONCURRENTLY mode
PostgreSQL 19 introduces a native REPACK command that unifies VACUUM FULL and CLUSTER. The CONCURRENTLY option rewrites bloated tables without a long ACCESS EXCLUSIVE lock, and the new pg_stat_progress_repack view tracks progress.
- REPACK merges VACUUM FULL and CLUSTER, with VERBOSE, ANALYZE and CONCURRENTLY options
- CONCURRENTLY captures changes via logical decoding and locks only for the final file swap
- In a test, a 1M-row table shrank from 1582 MB to 459 MB in about 27 seconds
- Limits: UNLOGGED and partitioned tables, no primary key, or running inside a transaction block
Read next
Software