PostgreSQL 19 Introduces Native REPACK Command to Remove Table Bloat Online

PostgreSQL 19 introduces a built-in REPACK command that consolidates the functionality of VACUUM FULL and CLUSTER into a single native operation. Unlike its predecessors, REPACK includes a CONCURRENTLY option that avoids holding a prolonged ACCESS EXCLUSIVE lock during the table rewrite, keeping the table accessible throughout. Changes made during the copy phase are captured via logical decoding and replayed just before the final file swap, which requires only a brief exclusive lock. A new system view, pg_stat_progress_repack, allows DBAs to monitor the operation's progress in real time across multiple phases. The third-party pg_repack extension remains relevant for PostgreSQL 18 and earlier, as well as for edge cases such as partitioned tables that the new core command does not yet fully handle.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in