PostgreSQL 19 halves foreign-key insert overhead and replaces pg_repack

What Changes When You Upgrade from PostgreSQL 18 to 19

I benchmarked PostgreSQL 18.6 against 19.0 on real workloads. Batch inserts into foreign-key tables dropped 41% (202ms to 119ms) because 19 checks the parent's unique index directly. NOT IN queries now use a hash anti join, cutting 24.5% off a missing-ID count. The new REPACK (CONCURRENTLY) command reclaimed over half a table's disk space without blocking reads or writes, replacing pg_repack for most jobs. Also covered: pg_plan_advice for plan hints, ON CONFLICT DO SELECT, and WAIT FOR LSN for replica consistency.

If you subtract the no-foreign-key baseline, the extra overhead of the foreign-key check itself fell roughly in half, from around 155 ms to 74 ms.
  1. gwking

    I am surprised that "an already-open transaction that reads events for the first time after the swap can see an empty table" is considered acceptable.

    I am not a Postgres user, and I appreciate that production databases are complicated beasts. Do people who use Postgres for production think this sounds fine?

  2. yuuch

    From an app dev perspective, 19 feels pretty quiet—especially since SQL/PGQ and GROUP BY ALL got pushed out to 20.

    For ops, though, it's a huge quality-of-life release. Built-in REPACK (CONCURRENTLY), turning on logical replication without a restart, and turning JIT off by default finally fix some of the biggest day-to-day operational headaches without needing external extensions or workarounds.

  3. Scaled

    I can always tell when a new postgres comes out because one of my docker powered apps just breaks (just a selfhosted one, nothing actually important). The official docker for postgres attempts to do no auto update between versions and you're basically left to go figure it out yourself when `latest` breaks itself. This is by design, apparently.

    I know there's an argument for version pinning, but I don't want to have to handhold random docker containers. It should be automated IMO. It's become a deterrent for me wanting to deploy anything that depends on postgres.

More from this day

2026-11-28