DEV Community

Atheer
Atheer

Posted on

## Postgres 19 Repack: Faster, Built‑In Table Bloat Cleanup

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

Postgres 19 adds a new repack command. It cleans up table bloat without needing extra extensions. The operation runs inside the database engine, so there is no extra software to install. It works by creating a fresh copy of the table, moving live rows, and then swapping the old table out. This reduces lock time and speeds up the cleanup.

The new command can be run with a single SQL line:

CALL pg_repack.repack('public.my_table');
Enter fullscreen mode Exit fullscreen mode

It automatically handles indexes, toast tables, and foreign keys. Because it runs in a single transaction, the impact on concurrent queries is minimal. The built‑in tool also provides progress reporting, making it easier to monitor large tables.

Overall, Postgres 19 makes table bloat cleanup faster and simpler. No external tools are required, and the risk of long locks is lower. This improvement helps keep databases healthy with less manual effort.

Source: Postgres 19 Repack: Faster, Built‑In Table Bloat Cleanup

Top comments (0)