PostgreSQL 19: Update and What This Means for Data Engineers

PostgreSQL 19 adds REPACK CONCURRENTLY, logical replication with no restart, sequence sync, and read-your-writes on standbys.
Yuval Miles, Engineering @ Matia
PostgreSQL elephant logo next to the number 19 on a blue and pink gradient background

PostgreSQL 19 shipped in November. Where Postgres 18 was mostly about read speed, 19 makes Postgres easier to run as a source for data pipelines. Logical replication no longer needs a restart, sequences replicate, standbys can wait for a write before you read from them, and bloated tables can be rewritten without locking them. Those changes land in the CDC layer that moves Postgres data into Snowflake, BigQuery, Redshift, or Databricks.

Turn on logical replication without restarting Postgres

CDC from Postgres depends on logical decoding, which has always required wal_level = logical. Changing wal_level meant restarting the server. For many teams, that turned starting CDC into a maintenance-window ticket on a production primary, and some of those tickets sat for months.

Postgres 19 raises the effective WAL level to logical when you create the first logical replication slot. A new read-only setting shows what the server is actually using:

SHOW wal_level;            -- what the config file says
SHOW effective_wal_level;  -- what the server is running with
Enabling logical replication: Postgres 18 requires setting wal_level, scheduling a maintenance window, and restarting before creating a slot. In Postgres 19, creating the slot switches the WAL level to logical.

Sequences replicate, and publications can exclude tables

Logical replication has always skipped sequence values. After a failover to a subscriber, or a major-version upgrade done over logical replication, the first insert on the new primary could hit a duplicate key unless someone synced sequences by hand at cutover. Postgres 19 publishes sequences alongside tables:

CREATE PUBLICATION all_tables_sequences
  FOR ALL TABLES, ALL SEQUENCES;

‍On the subscriber, ALTER SUBSCRIPTION ... REFRESH SEQUENCES re-syncs the values. The publisher must run 19 or later. FOR ALL TABLES also takes an EXCEPT clause, so leaving out a few tables no longer means listing every other table by name:

CREATE PUBLICATION app_tables
  FOR ALL TABLES EXCEPT (TABLE audit_log, session_cache);

CREATE PUBLICATION app_tables

Read-your-writes on standbys

Plenty of teams point extraction jobs at a replica to keep load off the primary. When replay is behind, a job that reads the replica right after a write on the primary misses that write. WAIT FOR LSN makes the standby session wait until replay reaches a given point:
‍

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

-- On the standby, before reading
WAIT FOR LSN '0/0306EE20' WITH (TIMEOUT '5s');
SELECT * FROM orders WHERE updated_at > now() - interval '1 hour';

With the NO_THROW option, a timeout returns a status instead of raising an error.

Reading your own writes on a standby: a write commits on the primary, the job captures its LSN, the standby runs WAIT FOR LSN until replay catches up to that LSN, then the extraction query runs and sees the new rows.

REPACK replaces VACUUM FULL and CLUSTER

Tables with heavy update and delete traffic accumulate dead space, and that bloat slows queries. VACUUM FULL and CLUSTER reclaim it but hold an exclusive lock for the whole rewrite, which on a busy table means downtime. Previously, people either lived with the bloat or installed the pg_repack extension.

REPACK is now in core. With CONCURRENTLY, reads and writes continue during the rewrite, and the exclusive lock is held only for the final swap:

REPACK (CONCURRENTLY) events;
Reclaiming space from a bloated table: VACUUM FULL and CLUSTER block reads and writes for the whole rewrite. REPACK CONCURRENTLY in Postgres 19 keeps reads and writes running and locks only during a brief final swap.

Before you schedule REPACK, check:

  • Concurrent mode uses logical decoding, so it needs a free slot under the new max_repack_replication_slots setting.
  • The table needs a primary key or an index-based replica identity. Partitioned tables aren't supported.
  • The rewrite needs free disk equal to the table plus its indexes.
  • It isn't MVCC-safe. A transaction with a snapshot from before the repack sees the table as empty after the repack commits.

What this means for data engineers

If you run pipelines off Postgres, these are the changes to act on after you upgrade:

  • You can start CDC without a maintenance window. Creating the replication slot is enough. The slot still holds WAL until a consumer reads it, so keep alerting on slot lag and disk. On RDS, Aurora, or Cloud SQL, logical replication is a provider setting that may still need a reboot. Check your provider's docs.
  • Keep repacks and full refreshes apart. An extraction query whose snapshot predates a concurrent repack reads the table as empty, so schedule repacks outside resync windows.
  • Make replica reads wait for the batch. If extraction reads from a standby, capture the LSN when a batch commits and run WAIT FOR LSN before the job reads.
  • Once you're on 19, you can drop the sequence sync from future cutover runbooks.
  • Move ETL service accounts off md5. Postgres 19 logs a warning on every md5 login, and a later release removes md5 entirely.

Confirm before you upgrade

  • JIT is off by default because its cost estimates proved unreliable. If you run large analytical queries on Postgres, benchmark with jit = on.
  • io_workers is replaced by io_min_workers and io_max_workers, which let Postgres scale its I/O workers. Update your config.
  • RADIUS authentication is removed.
  • Default TOAST compression is lz4 on builds with LZ4 support.

Also in Postgres 19

  • pg_plan_advice and pg_stash_advice, for pinning query plans that regress as data changes.
  • Parallel index vacuuming in autovacuum, with table priority visible in pg_stat_autovacuum_scores.
  • Faster foreign key checks, which made bulk inserts nearly 2x faster in the project's testing.
  • INSERT ... ON CONFLICT DO SELECT, IGNORE NULLS for lead(), lag() and other window functions, and COPY to JSON.
  • New pg_stat_lock and pg_stat_recovery views, and an IO option for EXPLAIN ANALYZE.
  • A SERVER clause for CREATE SUBSCRIPTION, and retain_dead_tuples, for detecting updates that conflict with a concurrent delete

The full list is in the PostgreSQL 19 release announcement.

PostgreSQL 19 FAQ

Some common questions we’re seeing about the latest Postgres release.

Does PostgreSQL 19 need a restart to enable logical replication?

No. PostgreSQL 19 raises the effective WAL level to logical automatically when you create the first logical replication slot, so you can start CDC without restarting the server. The effective_wal_level setting shows the level in use.

What replaces VACUUM FULL in PostgreSQL 19?

The new REPACK command replaces VACUUM FULL and CLUSTER, which both still work for compatibility. REPACK (CONCURRENTLY) reclaims space from a bloated table without blocking reads or writes, as long as the table has a primary key or an index-based replica identity and isn't partitioned.

Does PostgreSQL 19 still support md5 passwords?

Yes, but it logs a warning after each successful md5 login. md5 was deprecated in PostgreSQL 18 and will be removed in a future release, so move users and service accounts to SCRAM authentication.

Replicating Postgres with Matia

Matia's Postgres connector reads changes through WAL streaming, which runs CDC over 4x faster on Aurora and about 2x faster on local Postgres, with less memory and I/O load on the production database. For large tables, parallel syncs split a full refresh across multiple clients. Ramp cut business-critical resyncs from 3.5 days to 4 hours.

Matia checks for schema changes on every run and alerts you in Slack when a sync breaks. Lineage traces the issue back to the source table

Book a demo to see a Postgres sync running end to end.

‍

Manage your data, not your tools
Explore Matia and learn how you can reduce total cost of ownership by 61% to spend more time on data initiatives
Get a free tiral