DEV Community

Kamal G for Database Engineering

Posted on Edited on

Postgres 19 Operational Improvements: What Actually Changes in Your Runbooks

TL;DR

PostgreSQL 19 (GA November 19, 2026) reduces writer blocking during concurrent table rewrites, removes the restart for logical activation when wal_level=replica, and turns JIT off by default to avoid compilation overhead unless explicitly enabled. Each change carries a constraint operators must plan for: REPACK (CONCURRENTLY) still takes a final exclusive lock and needs temporary disk space, slot-driven logical activation retains WAL retention risk, and analytical workloads that benefited from the previous JIT default need explicit jit=on to retain that benefit.

Before production use, rehearse concurrent rewrites with representative write traffic, monitor logical slots and WAL retention, and benchmark analytical queries with JIT enabled and disabled.

Which PostgreSQL 19 changes affect your runbooks?

Concurrent repacking demands disk space for a full table and index copy plus a final exclusive lock. Slot-driven logical activation introduces WAL retention risks. Analytical workloads need explicit configuration to retain previous JIT speeds.

Change Previous behavior or workflow PostgreSQL 19 behavior Remaining constraint or operator action
Table rewrite VACUUM FULL (full lock) or pg_repack extension REPACK (CONCURRENTLY) with SHARE UPDATE EXCLUSIVE during copy Final ACCESS EXCLUSIVE lock, temporary disk space, replica identity
Logical activation Change wal_level, restart server First logical slot raises effective level automatically Configured wal_level=replica, slot lifecycle management
JIT compilation On by default (PostgreSQL 18) Off by default Explicit jit=on where compilation demonstrably helps
Parallel autovacuum indexes Not available Can use parallel workers for index vacuuming and cleanup. autovacuum_max_parallel_workers defaults to 0 Manual configuration, constrained by max_parallel_workers
I/O worker pool Fixed pool (PostgreSQL 18) Adaptive pool with min/max/idle controls io_method is a startup setting. Old io_workers parameter removed

How does REPACK (CONCURRENTLY) change table rewrites?

REPACK is a new SQL command in PostgreSQL 19 core that rewrites a table into a fresh file, reclaiming dead-tuple space and optionally reordering rows by index. The concurrent mode avoids the full-duration exclusive lock. The core command doesn't inherit the pg_repack extension's flags or privilege model.

Ordinary REPACK holds ACCESS EXCLUSIVE throughout. REPACK (CONCURRENTLY) holds SHARE UPDATE EXCLUSIVE during the bulk copy, captures concurrent changes through logical decoding, replays most changes, then takes ACCESS EXCLUSIVE to apply any remaining changes and swap the files. The duration of that final interruption depends on outstanding changes and lock acquisition time. No bounded maximum is documented.

Constraints operators must plan for

Concurrent REPACK requires room for a full copy of the table and its indexes, plus potential sort space and separate storage for changes made during the rewrite. The command fails if more than about 104 million rows are updated or deleted during the rewrite. That limit applies to concurrent changes, not table size.

Transactions holding snapshots from before the rewrite can see the rewritten table as empty. Long-running reports and snapshot-based exports require explicit testing before production use.

Concurrent REPACK also requires a primary key or index-based replica identity and can't run inside a transaction block. It's not supported for materialized views, unlogged tables, partitioned parents, system catalogs, TOAST relations or user_catalog_table relations.

If the table lacks a primary key or index-based replica identity, schedule non-concurrent REPACK or VACUUM FULL in a maintenance window. Both hold ACCESS EXCLUSIVE through the rewrite and need temporary disk space. If that space is unavailable, free or add capacity before rewriting, or use ordinary VACUUM to make space reusable within the table. Defer the rewrite until long-running transactions that need an old snapshot can finish.

On a 2M-row aircraft-position table in a local PostgreSQL 19 beta 4 run using an M3 Pro with Docker Desktop, two CPUs and eight pgbench clients, REPACK (CONCURRENTLY) completed in 1.2 seconds with a 38 ms worst writer transaction, ordinary REPACK in 0.7 seconds with 585 ms, and VACUUM FULL in 0.8 seconds with 706 ms. In that local workload, the concurrent rewrite took longer overall while writers experienced shorter interruptions, consistent with the shorter exclusive phase. These are beta 4, single-table measurements, not PostgreSQL 19.0 production results. Rehearse on representative data, measuring disk usage, write churn, final lock wait duration and old-snapshot behavior before scheduling production use.

How does restart-free logical activation work?

PostgreSQL 19 activates logical decoding automatically when the first logical replication slot is created on a server configured with wal_level=replica, removing the restart previously required to reach wal_level=logical.

The configured wal_level parameter remains a startup-only setting. What changes is the effective level: creating a logical slot raises it to logical. Dropping or invalidating the last logical slot allows it to return to replica. The effective_wal_level preset option exposes the distinction. Activation is synchronous with slot creation. Deactivation is asynchronous, performed by the checkpointer.

PostgreSQL 19 dynamic WAL level switching between replica and logical based on logical replication slot creation, removal, and invalidation.

On standbys, WAL replay communicates logical-decoding status from upstream. Local configuration and slots become relevant on promotion, so failover testing should include the promoted node's intended configuration and slot state.

PostgreSQL 19 removes the restart for logical activation. Operators still need slot capacity planning, permissions and consumer management. Slots retain WAL and catalog resources even without a consumer. Abandoned slots remain a storage hazard. Include slot lifecycle checks and WAL retention monitoring in migration runbooks.

How does sequence synchronization work in logical replication?

PostgreSQL 19 can publish sequences. Initial values synchronize when a subscription is created with copy_data=true (the default). ALTER SUBSCRIPTION ... REFRESH SEQUENCES resynchronizes known sequences, and ALTER SUBSCRIPTION ... REFRESH PUBLICATION synchronizes newly published sequences. Synchronization is initial or requested, not continuous streaming of every increment.

Sequence definitions must match between publisher and subscriber. Subscriber values can drift as the publisher advances. Without a final REFRESH SEQUENCES before cutover, the subscriber may reuse sequence values already issued by the publisher, causing primary key conflicts. The publisher must be version 19 or newer, and workers are subject to max_sync_workers_per_subscription. Include sequence refresh steps in migration and cutover runbooks. Don't assume automatic sequence-safe failover.

PostgreSQL 19 logical replication sequence synchronization between publisher and subscriber using REFRESH SEQUENCES before migration cutover.

Why is JIT compilation off by default in PostgreSQL 19?

PostgreSQL 19 defaults jit to off because the planner can't reliably estimate LLVM compilation cost, creating latency cliffs where short queries pay more for compilation than they gain from native execution.

PostgreSQL 18 defaults jit to on when JIT support is available. An explicit jit=on in postgresql.conf, per-user or per-database settings remains in effect. The new default doesn't override explicit configuration. JIT cost thresholds (jit_above_cost, jit_inline_above_cost, jit_optimize_above_cost) remain configurable for workloads where compilation demonstrably helps.

The default change favors OLTP predictability. Analytical and data-warehousing workloads that benefited from the previous JIT default need explicit jit=on to retain that benefit on CPU-heavy queries. Audit existing JIT configuration before upgrading. For workloads relying on the previous default, benchmark representative analytical queries with jit=on versus off.

PostgreSQL JIT compilation overhead versus execution benefits for short OLTP queries and CPU-intensive analytical queries.

What other operational changes should you review?

Alongside the three main changes, PostgreSQL 19 adds parallel autovacuum index work and an adaptive I/O worker pool, changes the default TOAST compression method when built with LZ4 support, and lets ordinary query scans mark heap pages all-visible.

Autovacuum can use parallel workers for index vacuuming and index cleanup. autovacuum_max_parallel_workers defaults to 0. Setting it above 0 allows each autovacuum process to use parallel workers for index operations. A per-table autovacuum_parallel_workers setting can limit the per-process allowance. These index workers count against max_parallel_workers. Separately, increasing autovacuum_max_workers adds more concurrent autovacuum processes. Their count is governed by autovacuum_max_workers and autovacuum_worker_slots.

Maintenance prioritization also gains five score weights (transaction-ID age, multixact age, vacuum need, insert-driven vacuum need, analyze need), all defaulting to 1.0. The parallel VACUUM leader and workers now share the cost-delay limit, which can make parallel vacuum slower than on earlier versions with the same vacuum_cost_delay and vacuum_cost_limit settings. Review and adjust delay settings when enabling parallel autovacuum.

PostgreSQL 18 introduced AIO for sequential scans, bitmap heap scans and vacuum. PostgreSQL 19 adds an adaptive I/O worker pool with io_min_workers (default 2), io_max_workers (default 8), io_worker_idle_timeout (default 1 minute) and io_worker_launch_interval (default 100 ms). These four controls affect only io_method=worker, not io_uring or sync. The old io_workers parameter is removed. Existing configuration automation that sets it will need updating. io_method remains a startup setting.

PostgreSQL 19 defaults default_toast_compression to lz4 when built with LZ4 support. Otherwise it defaults to pglz. The setting affects newly compressed values, and existing TOAST values aren't automatically recompressed.

Ordinary query scans can now mark heap pages all-visible, reducing VACUUM's exclusive contribution to visibility-map maintenance. This doesn't eliminate VACUUM's other responsibilities.

What should you check before upgrading to PostgreSQL 19?

Before upgrading, confirm that the server binaries, extension builds, operator images, monitoring collectors and authentication configuration are ready, and that a rollback path is available.

Run pg_upgrade --check before scheduling the maintenance window. It can check a running old cluster while the initialized new cluster remains stopped. In that case, use different old and new ports. Pass the intended transfer-mode option (--link, --clone, --copy-file-range or --swap) with --check to enable mode-specific checks. The check identifies blockers such as CR/LF names and affected btree_gist indexes. The actual upgrade requires stopping both clusters.

Copy and clone modes preserve the old cluster for rollback. Clone mode reduces copying only on supported operating systems and filesystems. Link mode also reduces copying, but starting the new server makes the old cluster unsafe to use because files are shared. Keep an independent backup for the upgrade. Extension binary compatibility isn't verified by pg_upgrade. Install new-version modules before upgrading.

PostgreSQL pg_upgrade copy, clone, and link transfer modes compared by file sharing, old cluster preservation, and rollback safety.

A CloudNativePG issue opened November 21, 2026 requested a PostgreSQL 19 pgvector extension image. Check extension images and operator compatibility separately from core server image availability before upgrading.

Configuration and compatibility items

Priority Item Upgrade check or action
Blocking Database/role/tablespace names with CR/LF Correct before upgrade. pg_upgrade rejects them
Blocking btree_gist indexes using inet/cidr Follow documented upgrade restriction
Breaking RADIUS authentication removed Replace affected authentication entries
Breaking io_workers removed Replace with io_min_workers / io_max_workers and related controls
Breaking standard_conforming_strings forced on Review dump files and automation relying on off
Review max_locks_per_transaction default: 64 to 128 Reassess lock allocation with new semantics
Review vacuum_cost_delay / vacuum_cost_limit sharing Review when enabling parallel autovacuum. Shared delay can reduce throughput
Review Subscription statistics consumers Update collectors for renamed and newly separated counters
Advisory log_lock_waits defaults on Expect increased log volume
Advisory Password-expiration and MD5 warnings Configure or suppress authentication warnings

Checksum and COPY changes across releases

Online checksum enablement was removed in Beta 4 (September 24, 2026). pg_checksums requires a clean shutdown.

COPY ... ON_ERROR ignore originated in PostgreSQL 17. REJECT_LIMIT arrived in PostgreSQL 18.

Monitoring updates

pg_stat_progress_repack covers REPACK, CLUSTER and VACUUM FULL with phase, heap-progress and catch-up counters. pg_stat_wal.wal_fpi_bytes adds full-page-image byte volume. A new pg_stat_lock view is available, and VACUUM/ANALYZE logging now includes WAL full-page-image byte information. Update monitoring dashboards, collector schemas and alert thresholds as part of upgrade validation, not after production cutover.

Upgrade sequence

  1. Verify extension and image availability for PostgreSQL 19 and confirm the rollback path.
  2. Run pg_upgrade --check against the live old cluster.
  3. Update configuration: replace the removed io_workers parameter and affected RADIUS authentication entries. Review new defaults (jit, max_locks_per_transaction, log_lock_waits, default_toast_compression). Check the parallel-autovacuum worker budget against max_parallel_workers. Benchmark jit=on and off if the workload relied on the previous default.
  4. Update monitoring collectors, counter names, and alert thresholds for renamed and new statistics before production cutover.
  5. Rehearse REPACK (CONCURRENTLY), logical activation, and parallel autovacuum on representative staging data before production cutover: measure rewrite disk space and final lock waits, audit slots and WAL retention, and plan sequence refresh for replication cutover.

Frequently asked questions about PostgreSQL 19 operational changes

Does REPACK (CONCURRENTLY) eliminate all locking?

No. Concurrent REPACK holds SHARE UPDATE EXCLUSIVE during the bulk copy and replay, then takes ACCESS EXCLUSIVE for the final file swap. The duration of that final lock depends on outstanding changes and lock acquisition time. Rehearse on representative data to measure the interruption.

Does PostgreSQL 19 eliminate the restart for logical replication setup?

On a server configured with wal_level=replica, creating the first logical replication slot raises the effective WAL level to logical without a restart. The effective_wal_level preset option exposes the current state. A server configured with wal_level=minimal doesn't gain this path, and wal_level itself remains a startup-only parameter.

Should I re-enable JIT after upgrading?

Test before deciding. JIT benefits some CPU-heavy analytical queries but adds compilation overhead when it runs on short OLTP queries. If postgresql.conf already sets jit=on explicitly, the new default doesn't change behavior. Analytical workloads that benefited from the previous JIT default need explicit jit=on to retain that benefit. Benchmark representative queries both ways.

Does upgrading to PostgreSQL 19 automatically enable parallel autovacuum?

No. autovacuum_max_parallel_workers defaults to 0. Set it to a nonzero value and ensure max_parallel_workers can accommodate the additional demand. Test with the new shared cost-delay behavior, which can make parallel vacuum slower than on earlier versions with the same delay settings.

Can WAIT FOR LSN provide read-your-writes consistency on standbys?

For read-your-writes, capture an LSN at or after the primary transaction's COMMIT record, then run WAIT FOR LSN with MODE 'standby_replay' on the intended standby before reading. Set a positive timeout. An omitted or zero timeout waits indefinitely. On promotion or timeout, the command raises an error unless NO_THROW requests a not in recovery or timeout status. WAIT compares numeric LSNs without timeline awareness, so connection routing and timeline validation remain separate. On November 20, PostgreSQL 19.0 was reported to have an exact-WAL-page-boundary wait that can stall pending later WAL. A fix was committed for 19.1. Check the installed maintenance release and keep the timeout.

Top comments (0)