News 4 min read

PostgreSQL 19 released with REPACK, WAIT FOR LSN and JSON COPY


The PostgreSQL Global Development Group released PostgreSQL 19 on November 19, 2026. The new major version adds a REPACK command that can rebuild bloated tables without blocking reads or writes, WAIT FOR LSN for read-your-writes consistency on standbys, and INSERT ... ON CONFLICT DO SELECT. It also turns JIT off by default and drops RADIUS authentication, so check the upgrade notes before moving a production cluster.

What’s new

REPACK replaces VACUUM FULL and CLUSTER. The new command reclaims space from table bloat and can reorder a table’s rows to match an index. With REPACK (CONCURRENTLY) it does that while the table stays readable and writable. VACUUM FULL and CLUSTER still work for compatibility.

Plan advice. Two new extensions deal with unstable query plans. pg_plan_advice lets you pin or experiment with plan choices using a “plan advice” mini-language, and pg_stash_advice stores that advice and applies it automatically to matching queries by their query identifier, so a slow plan can be fixed without touching application code.

Autovacuum and monitoring. Autovacuum can now vacuum indexes with parallel workers (autovacuum_max_parallel_workers) and uses a new scoring system to pick which tables to process first; the new pg_stat_autovacuum_scores view shows that ranking. Other new views are pg_stat_lock (statistics per lock type) and pg_stat_recovery. EXPLAIN ANALYZE gets an IO option that reports asynchronous I/O activity.

Replication. Logical replication no longer needs a restart to switch on: the effective WAL level is raised to logical automatically when the first logical replication slot is created, and the new effective_wal_level setting shows the level in use. CREATE PUBLICATION can publish sequences with FOR ALL SEQUENCES and skip tables with EXCEPT when publishing FOR ALL TABLES. CREATE SUBSCRIPTION ... SERVER reads connection settings from a foreign server, and postgres_fdw can import remote table statistics during ANALYZE with the import_stats option.

SQL and performance. The announcement lists:

  • INSERT ... ON CONFLICT DO SELECT, so RETURNING can give back the existing row that blocked an insert: a “get or create” in one round trip.
  • COPY output as JSON, including as a single JSON array.
  • SQL/JSON path string methods: lower(), upper(), replace(), split_part() and btrim().
  • IGNORE NULLS for the lead(), lag(), first_value(), last_value() and nth_value() window functions.
  • random() for dates and timestamps within a range.
  • Faster foreign key checks, which the project says made bulk inserts “nearly 2x faster” in testing, plus NOT IN rewritten as an anti-join when no NULLs are present and eager aggregation before joins (enable_eager_aggregate).
  • Better LISTEN/NOTIFY scalability with many channels, and SNI support, so one server can present different TLS certificates per hostname through a new pg_hosts.conf file.

Why it shipped in November

PostgreSQL majors usually ship between mid-September and mid-October. Robert Haas wrote on his blog in October that this one slipped largely because LLMs made existing bugs much easier to find. Commits to the release branch between feature freeze (April 8) and September 25 rose from 724 for version 18 in 2025 to 1,169 for version 19 in 2026, and reviewers spent more time on security and back-branch fixes. Three planned features were reverted before release: UPDATE/DELETE FOR PORTION OF, SQL property graph queries (SQL/PGQ) and ALTER TABLE ... MERGE PARTITION/SPLIT PARTITION. Other big projects have been patching serious bugs this autumn too, such as the Java4Shell bug in OpenJDK and the nginx HTTP/2 vulnerabilities.

What it means for developers

The feature application developers will feel first is WAIT FOR LSN. After a write on the primary, read the current WAL position, then make a session on a standby wait until it has replayed that far before you query it. This example is from the docs:

-- on the primary, after the write
SELECT pg_current_wal_insert_lsn();   -- 0/0306EE20

-- on the standby, before reading
WAIT FOR LSN '0/0306EE20' WITH (TIMEOUT '100ms', NO_THROW);

The command returns success, timeout or not in recovery; without NO_THROW, a timeout raises an error. A MODE option chooses what to wait for: standby_replay, standby_write, standby_flush or primary_flush. Simon Willison points out that MediaWiki has long done the same thing by hand on MySQL, storing the primary’s position in the user’s session so a user always sees their own edits even when replicas lag.

Before upgrading, note these changes from the announcement:

  • JIT is off by default, because its cost estimates proved unreliable. Turn it back on if you run many large analytical queries.
  • io_workers is gone, replaced by io_min_workers and io_max_workers; with the default io_method of worker, the pool now sizes itself between the two.
  • md5 passwords now log a warning after each successful login (silence it with md5_password_warnings) and will be removed in a future release. Move to SCRAM.
  • RADIUS authentication has been removed.
  • TOAST compression defaults to lz4 on builds with LZ4 support.

Packages for Windows, Linux and macOS are on the download page, and the release notes have the full list of changes.

Sources