Postgres 19's REPACK (CONCURRENTLY) Skips Partitioned Tables and Is Not MVCC-Safe
Software / explainer
Postgres 19's REPACK (CONCURRENTLY) Skips Partitioned Tables and Is Not MVCC-Safe
The new command replaces VACUUM FULL and CLUSTER, but its reference page lists nine cases where the concurrent mode refuses to run.

PostgreSQL 19, released Nov. 19, adds a REPACK command that rewrites a bloated table into a fresh file and hands the freed space back to the operating system. Its CONCURRENTLY option does the work without the lock that made VACUUM FULL a maintenance-window job.
The PostgreSQL 19 release notes credit Antonin Houska with the command, and Houska, Mihail Nikalayeu and Álvaro Herrera with the concurrent mode. The REPACK reference page is blunter about limits than the release summary, and those limits decide who can use the mode on day one.

What REPACK replaces in Postgres 19
The release notes say the two older commands "did similar things, but with confusing names, so unify them as REPACK. The old commands have been retained for compatibility." Both stay.
REPACK reclaims the space held by dead tuples, the old row versions that updates and deletes leave behind. VACUUM marks that space reusable inside the file. REPACK instead copies the live rows into a new file "with no extra space (except for the space guaranteed by the fillfactor storage parameter)", then swaps the files.
The syntax is short: REPACK employees; rewrites one table, REPACK employees USING INDEX employees_ind; also physically reorders it by that index, and REPACK (CONCURRENTLY) employees USING INDEX; reuses the table's configured clustering index. Progress shows up in a new pg_stat_progress_repack view, which the notes credit to Herrera.
Without CONCURRENTLY, the page says REPACK holds an ACCESS EXCLUSIVE lock on the table for the whole rewrite.
Nine conditions that block the concurrent mode
The reference page lists nine cases where CONCURRENTLY cannot be used: the relation is not a table, the table is UNLOGGED, the table is partitioned, it lacks a primary key and index-based replica identity, it is a system catalog or TOAST table, its access method is not heap, it is declared with user_catalog_table, the command runs inside a transaction block, or max_repack_replication_slots has no free slot.
The slot requirement follows from the design. The bulk of the job runs under a SHARE UPDATE EXCLUSIVE lock, and changes made meanwhile are captured through logical decoding, Postgres's change-stream machinery, then replayed before a final ACCESS EXCLUSIVE swap.
A partitioned table can still be repacked, but not concurrently: the page says repacking one repacks each partition, and foreign-table partitions are skipped.
| Table property | REPACK (CONCURRENTLY) | pg_repack |
|---|---|---|
| Key required | Primary key or index-based replica identity | Primary key, or a unique total index on a NOT NULL column |
| Change capture | Logical decoding, a replication slot | Trigger and a log table |
| Free disk | At least table plus index sizes | About twice the table and indexes |
| Short ACCESS EXCLUSIVE lock | Final swap | Initial setup and final swap |
The 104 million row limit and the MVCC warning
The page sets a hard ceiling: "if more than about 104 million rows are concurrently updated or deleted during the execution of REPACK, the command fails." Each such change costs a fixed small amount of memory that maintenance_work_mem does not cap, and the full tuple data goes to disk.
A warning box adds that the concurrent mode "is not MVCC-safe." MVCC, multiversion concurrency control, is how each transaction sees a consistent snapshot. After the repack commits, the page says, the table "will appear empty to concurrent transactions, if they are using a snapshot taken before repacking started." A long-running report that began before the swap would read nothing.
Failure is also priced in. The page says REPACK "can fail after most of the work is done, especially with CONCURRENTLY on a busy table." DDL from another session on the same table can cause the same outcome.
It also counts as one long transaction for wraparound purposes, which stops VACUUM cleaning dead rows from other tables. The page advises watching pg_stat_activity.backend_xid while repacking very large tables.
Where pg_repack still has the edge
pg_repack, the extension that does this job on older releases, has 2,326 GitHub stars and was last pushed on Nov. 19. Its README lists support for PostgreSQL 9.5 through 19, so it is the only option on any release before 19.
It also documents an index-only repack, which builds replacement indexes with CREATE INDEX CONCURRENTLY and swaps them in. The REPACK page lists only three options, VERBOSE, ANALYZE and CONCURRENTLY, and none of them rebuilds indexes alone.
The disk numbers differ. The pg_repack README gives 2 GB of extra space for 1 GB of tables and indexes. The REPACK page asks for free space "at least equal to the sum of the table size and the index sizes", and up to a table's size more for a sort file when USING INDEX is combined with a sequential scan. Those are the two documents' own figures, and The Terminal did not measure either.
One number is missing from the reference page: how long the final ACCESS EXCLUSIVE lock is held. It says only that the lock is "typically held for a short time, depending on the amount of changes accumulated while the lock was being waited for."
For a different case of a vendor page leaving out the number a reader needs, see Chrome's Gemini Nano download docs. For another open-source project where a headline severity score met a reviewer's doubts, see the OpenSSL EVP_EncodeBlock advisory.
Sources
More in Software
- 01Brazil's Receita Federal Posts Tax Calculator Under MIT With 16 Open IssuesThe agency published three repositories on Nov. 16 for the new consumption taxes, and outside developers had filed bug reports against the first within days.
- 02OpenSRE Hits 13,884 Stars After Repositioning Toward CI/CD FailuresThe Apache-2.0 agent is labelled public alpha, ships a dated release almost every day, and sends analytics and crash reports unless users set an environment variable.
- 03Microsoft 365's 1,430-Minute Outage Traces to a July Windows ChangeMicrosoft's preliminary report blames a latent lock-contention defect, a Teams failover and 14 percent of gateway capacity already offline, and customers have until the end of December to claim service credits.
- 04Firecrawl's Alexandria Data Library Is Missing From Its 205,955-Star RepoThe AGPL-3.0 repository covers scraping and a self-hosted server, while the 550-provider data library and search run on Firecrawl Cloud.