Concurrent database maintenance

PostgreSQL 19 Makes Table Repacking Concurrent, but Maintenance Still Has a Cost

The new release adds REPACK (CONCURRENTLY), plan advice and a replica consistency primitive. Each addresses a different operational bottleneck.

Parallel lanes show application traffic continuing while a fragmented table is repacked, then a brief final switch.

PostgreSQL 19, released on November 19, brings several changes relevant to operators of large installations. REPACK (CONCURRENTLY) reorganizes a table without blocking normal reads and writes for the duration of the work. The release notes also describe pg_plan_advice for influencing query plans and WAIT FOR LSN for replica read-your-writes coordination. These solve different problems and should be evaluated separately.

Repacking while applications run

Table bloat accumulates as updates and deletes leave space that is not always reused in the desired pattern. Historically, reclaiming it can require awkward maintenance windows or external approaches with their own operational constraints. Concurrent repacking changes the availability tradeoff: traffic can continue while a replacement representation is built, followed by a short final switch. It does not make the operation free. Extra disk space, storage throughput, WAL generation and replication lag can determine whether the procedure is safe at peak load.

Before using it on a large table, operators should estimate table and index sizes, available free space, write rate and replica headroom. A rehearsal on a representative dataset should monitor latency, I/O, WAL volume and the finishing phase. Existing backup and rollback procedures still matter.

Two other control points

pg_plan_advice adds a mechanism to guide a query’s chosen plan when optimizer decisions fluctuate. It is a control surface, not proof that all queries become faster; stale assumptions can preserve an inefficient plan as data changes. WAIT FOR LSN gives an application a way to wait until a replica has replayed a specified log position, addressing a specific read-after-write consistency need. That wait can add latency and cannot replace a broader replication and failover design.

This release is a toolkit for maintenance, planning and consistency rather than a universal speedup. Benchmark the workload, test the migration and inspect extension compatibility before rollout.

Sources: PostgreSQL 19 announcement and official release notes.