Skip to content

Build Not yet confirmed elsewhere1 publisher 2 min read Published

Postgres 19's REPACK CONCURRENTLY trades VACUUM FULL's table lock for a 3.8x rise in average insert latency

Postgres 19's REPACK CONCURRENTLY cut a 200M-row table from 19 GB to 4117 MB in about 66 seconds in depesz's test, with inserts running. Average insert latency rose from 1.469 ms to 5.536 ms during that window.

The Engineer · Build desk

Send a correction

Illustration accompanying Postgres 19's REPACK CONCURRENTLY trades VACUUM FULL's table lock for a 3.8x rise in average insert latency
Generated illustration
Inserts slowed but kept running through the repack Insert latency in depesz's test while REPACK CONCURRENTLY rewrote the table, with an insert loop running the whole time.

During the repack, the average insert took 5.536 ms, against 1.469 ms before it. The slowest insert during the repack took 63 ms. The repack took about 66 seconds.

Inserts slowed but kept running through the repack
FigureValueNoteClaim
Average insert latency during the repack5.536 ms3
Average insert, before1.469 ms3
Slowest insert in repack63 ms4
Repack run, about66 seconds2

What happened

  • VACUUM FULL and CLUSTER hold an ACCESS EXCLUSIVE lock for the whole rewrite, so every read and write on the table waits until it finishes.
  • CONCURRENTLY builds the new copy under a SHARE UPDATE EXCLUSIVE lock and decodes concurrent changes through a replication slot and a background worker, then replays them just before the file swap.
  • The commit that added the option went in on April 6, 2026, committed by Alvaro Herrera and mostly Antonin Houska's code.
  • PostgreSQL 19 is still in beta, and the official postgres image publishes a 19beta4 tag to try it on.

Why it matters

  • What it costs cost Writers pay for the online rewrite: about 4 ms more per insert on average for the roughly 66 seconds of the run, where VACUUM FULL charges in blocked sessions.
  • What it limits constraint A table needs a primary key or an index-based replica identity before REPACK CONCURRENTLY will touch it, so keyless tables still need another route.
  • Who has to decide decision Replacing pg_repack or pg_squeeze with the core command is a call to make after a rerun on a copy of your own table, since the one published run is a development build.

The two latency numbers measure different things, so take them apart. The average insert took about 3.8 times as long during the repack [14]. The slowest insert, at 63 ms [4], was about 11 times that raised average [15]. The post reports only a mean and a maximum, with nothing on the middle of the distribution and no figure for the loop's insert rate.

Writers are not blocked. Their changes are decoded through a replication slot by a background worker and replayed just before the files are swapped [6]. That is where the extra time can come from: every row the insert loop adds during the copy is a row that worker has to decode and replay.

Set that against the lock. In the post's demo, a long-running report that touched the table and has not committed [13] sits ahead of the VACUUM FULL request. The post says one ACCESS EXCLUSIVE request at the front of the line makes everything behind it wait [12]. In our view, a few milliseconds on each insert is a fair price against that queue, for a table that has to stay writable and a write path with headroom.

For the number to transfer, your row width, insert rate and hardware would all have to resemble depesz's, and the post describes neither his hardware nor his row width. The run used the PostgreSQL 19 development branch in April [1], not a release.

Extension users will recognise the design. According to CYBERTEC, pg_repack creates a set of triggers on the table, and its own pg_squeeze uses logical decoding instead [10]. The core command follows the second approach. The reported figures cover REPACK CONCURRENTLY alone, so whether it is cheaper for writers than either extension is untested here.

The release notes explain the rename: "The two former commands did similar things, but with confusing names, so unify them as REPACK. The old commands have been retained for compatibility." [11]

What to watch

  • A rerun on 19beta4 or later that publishes the insert rate and latency percentiles, not only a mean and a maximum.
  • Documentation or release notes stating what lock the final file swap takes and how long writers wait there.
  • A same-table comparison of REPACK CONCURRENTLY against pg_repack and pg_squeeze on write latency.

Clarity's read

What the record supports and how the coverage leans. The claims behind it follow.

Reality

Evidence55
Adoption
Not scored
Hype gap+10
Incentives
Not scored
Confidence50
Why these scores

Claim ledger

Ranked by verification strength, evidence, and original report placement.

  1. [1]

    depesz ran the test against the PostgreSQL 19 development branch in April: 200 million rows, 80% deleted, then repack (verbose, analyze, concurrently).

    Reported Supported Source: dev.to post describing depesz's testView cited source
  2. [2]

    The table went from 19 GB to 4117 MB in about 66 seconds, with an insert loop running the whole time.

    Reported Supported Source: dev.to post describing depesz's testView cited source
  3. [3]

    Average insert latency rose from 1.469 ms to 5.536 ms during the repack.

    Reported Supported Source: dev.to post describing depesz's testView cited source

Get this ledger inside ChatGPT. Ask about any of our stories and the answer brings its figure, each claim’s verdict and the sources. Free, no account.

Add to ChatGPTAdd to Claude

Sources

1 independent publisher whose own reporting we read for this story.

  1. dev.to

    1 article · October 15, 2026

    VACUUM FULL Locks Your Table the Whole Time. Postgres 19's REPACK CONCURRENTLY Doesn't

Share your take

Let Clarity write the post for you.

Signed-in readers get a short post drafted on this story in the register they choose — narrative, analytical, or a direct position — editable to the last word before it goes anywhere. The share buttons at the top of this story work without an account.

Topics and entities

Follow any of these and your For You feed starts watching them — no settings page required.

Topics

Entities

Loading related stories