Stories

PostgreSQL 19 Released: A Practical Release Built Around Operational Control

Published 20 November, 202613 min read

On November 19, 2026, the PostgreSQL Global Development Group announced the release of PostgreSQL 19, the latest major version of the world's most advanced open source database. Unlike releases that introduce one sweeping headline capability, PostgreSQL 19 is deliberately practical. It targets the operational problems that database teams know intimately: bloated tables, unstable query plans, replica lag, stalled autovacuum, and maintenance work that is hard to run safely in production. The common thread across the release is control, giving operators more ways to step in when defaults are not enough without sacrificing the project's long-standing bias toward reliability.

"For over 30 years, the global open source community has built PostgreSQL into a database that organizations trust with their most critical data," said Jonathan Katz, a member of the PostgreSQL core team. "PostgreSQL 19 continues that commitment to reliability, giving users new ways to manage their workloads without disruption and to build applications that span multiple systems."

This article walks through the most consequential changes, what problem each one solves, and what teams should know before upgrading.

REPACK: Reclaiming Space Without the Maintenance Window

PostgreSQL's multiversion concurrency control means every UPDATE writes a new row version and every DELETE leaves a dead tuple behind. Routine vacuuming makes that space reusable internally, but it does not return space to the operating system or restore a useful physical row order. Over time, heavily updated tables accumulate bloat: index scans slow down, sequential scans read more pages than the live data warrants, and disk usage climbs without any growth in actual rows.

Until now, the fixes inside core were VACUUM FULL and CLUSTER, both of which rewrite the table while holding an ACCESS EXCLUSIVE lock for the entire operation. On any actively queried table, that makes them nearly unusable outside a dedicated maintenance window, which is why many operators reached for extensions such as pg_repack or pg_squeeze.

PostgreSQL 19 introduces the REPACK command, which unifies both jobs and adds an online mode:

REPACK t;                          -- reclaims space, like VACUUM FULL
REPACK t USING INDEX t_pkey;       -- also reorders rows, like CLUSTER
REPACK (CONCURRENTLY) t;           -- online: reads and writes continue

The concurrent form works by keeping the most expensive part of the rewrite non-blocking. It takes a SHARE UPDATE EXCLUSIVE lock, which permits reads and writes, captures an MVCC snapshot of the table, opens a replication slot at that snapshot, and builds a new copy of the table and its indexes. While the copy is built, incoming changes to the old table are decoded from the write-ahead log into a backlog. Once the copy is ready, the backlog is replayed, PostgreSQL upgrades to an ACCESS EXCLUSIVE lock to apply the final batch of changes and swap the new files into place, and the lock is released. The expensive steps run without blocking; only the final swap does, and its duration scales with write traffic rather than table size.

The caveats matter. Concurrent repacking requires a non-deferrable primary key or a suitable index-based replica identity, needs disk space for a second copy of the table and indexes, holds a replication slot for the duration, and cannot run inside a transaction block. It is also not MVCC-safe: once the swap commits, transactions using snapshots taken before the repack began can see the new table as empty. Concurrent does not mean lock-free, but it converts a maintenance-window job into something that can run against a live table with a brief blocking phase, which is a genuine operational win.

Plan Advice: Stabilizing the Planner When It Goes Wrong

PostgreSQL's cost-based optimizer is excellent at the average case and occasionally wrong at the long tail. Per-table statistics cannot capture cross-table correlations. Consider a case where enterprise customers make up 0.1% of customers but generate 30% of orders. The planner may estimate a handful of orders per customer and choose a nested loop that repeatedly probes an index, when a hash join would be far faster for the real data distribution.

PostgreSQL has historically refused native optimizer hints, on the reasonable grounds that a hint hard-codes today's data distribution into tomorrow's plan. Workarounds all lived outside core: the pg_hint_plan extension, application-level SET enable_* flags, or third-party plan-locking tools, each with its own semantics and lifecycle.

PostgreSQL 19 changes this with two bundled extensions. pg_plan_advice is a planner-advisor framework: it can describe a plan's relevant choices (join order, join method, scan method) as an advice string, apply supplied advice, and report whether the resulting plan followed it. You can generate advice with EXPLAIN (PLAN_ADVICE) and test it by supplying the advice string before re-running the query.

EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM orders o JOIN customers c ON o.cust_id = c.id;
-- returns advice such as: JOIN_ORDER(o c) HASH_JOIN(c) SEQ_SCAN(o c)

The companion pg_stash_advice extension stores advice in shared memory, keyed by stash name and query identifier, and applies it automatically at planning time to matching queries. The correction lives entirely outside the application's SQL text, so you can fix a regressed plan without touching the codebase and without re-applying the fix after every deployment.

This is a middle ground that is very Postgres-flavored: the optimizer stays in charge, hints are not embedded in queries, and advice is a manageable, inspectable artifact. Scope is controlled through the pg_stash_advice.stash_name setting, which can be applied at the database, role, or session level. The right use case is a small set of critical queries with known planner regressions on production data, used as a scalpel rather than a blanket, since applying advice has a cost even when it does not change the plan. Treat it as a targeted patch while you address the underlying cause, such as stale statistics or a missing index.

Autovacuum That Can Keep Up, and Show Its Work

Autovacuum has been single-threaded for its entire history, which becomes a real constraint once a database has more large or high-churn tables than one worker can process. PostgreSQL 19 lets autovacuum vacuum indexes using parallel workers, controlled by the new autovacuum_max_parallel_workers setting, with per-table tuning through the autovacuum_parallel_workers storage parameter. On tables with multiple large indexes, index vacuuming now takes roughly the time of the largest single index rather than the sum of all of them.

Just as important is visibility. A new scoring system decides which tables autovacuum processes first, and the pg_stat_autovacuum_scores view exposes why a table is queued ahead of another, with a family of autovacuum_*_score_weight settings letting operators tune the priority function. Progress reporting improves as well: pg_stat_progress_vacuum distinguishes manual versus autovacuum runs and normal versus aggressive or failsafe mode, and logs now report both the number of parallel workers planned and the number actually launched, which often diverge.

The release also reduces future vacuum work. Queries that read a table can now automatically mark pages as all-visible in the visibility map during execution. And in a welcome maintenance fix, vacuumdb --analyze-only now analyzes partitioned tables when no tables are specified.

New Monitoring Views and EXPLAIN Options

Several diagnostic blind spots close in this release. pg_stat_lock collects cluster-wide statistics by lock type, including waits, wait time, and fast-path slot exhaustion, making it possible to spot a rise in contention with a direct query rather than by correlating logs. pg_stat_recovery brings replay positions, timelines, promotion state, the last replayed transaction timestamp, and recovery pause state into one view, consolidating what previously required scattered function calls on standby dashboards.

Query diagnostics improve too. The new IO option for EXPLAIN ANALYZE, and the matching auto_explain setting, report asynchronous I/O activity per plan node, which makes it far easier to identify the exact step in a query driving excessive reads. PostgreSQL 19 also reports the amount of WAL written for full-page images in pg_stat_wal, in EXPLAIN (ANALYZE, WAL), and in vacuum and analyze log events.

Logical Replication Without the Restart, and With Sequences

Logical replication has become core infrastructure for change data capture, migrations, and zero-downtime upgrade workflows, but two gaps have persisted. First, enabling it often required changing wal_level and restarting the server, which is disruptive on a production primary. PostgreSQL 19 removes that friction: when wal_level is replica, creating the first valid logical replication slot automatically raises the effective WAL level to logical, and the new read-only effective_wal_level setting shows what is currently in use.

Second, logical replication has faithfully copied table data since PostgreSQL 10 but never the sequences backing SERIAL and IDENTITY columns. Promote a subscriber to primary and the next INSERT could trigger a primary-key violation against values the application thought it owned. PostgreSQL 19 adds sequence synchronization: publications can include sequences with FOR ALL SEQUENCES, initial subscription setup copies values by default, and ALTER SUBSCRIPTION ... REFRESH SEQUENCES re-synchronizes values already subscribed. Because later sequence changes are not streamed continuously, runbooks should refresh sequences immediately before cutover.

Other replication refinements round out the picture. CREATE PUBLICATION ... FOR ALL TABLES now accepts an EXCEPT clause to exclude specific tables. CREATE SUBSCRIPTION can take its connection settings from a foreign server defined with postgres_fdw using the SERVER clause. The new retain_dead_tuples subscription option preserves enough information to detect updates that conflict with a concurrent delete, with those conflicts counted in pg_stat_subscription_stats.

WAIT FOR LSN: Read-Your-Writes on Standbys

Applications that route reads to asynchronous replicas face a classic race: a write commits on the primary, the application immediately reads from a standby, and the row is not there yet because replay has not caught up. The usual fixes were application-side polling or arbitrary sleeps.

PostgreSQL 19 provides the missing synchronization step directly. An LSN (log sequence number) identifies a position in the WAL, and the new WAIT FOR LSN command blocks a standby session until replay has reached at least the requested position:

-- On the primary, after the write commits:
SELECT pg_current_wal_insert_lsn();

-- On the standby, with the LSN returned above:
WAIT FOR LSN '0/0306EE20' WITH (TIMEOUT '2s');
-- then run the read

The client or connection pooler still has to carry the LSN from primary to replica, and failover still requires timeline handling since WAIT FOR LSN compares positions numerically. But read-your-writes consistency no longer needs polling, and a timeout turns silent stale reads into a visible error.

Related to distributed setups, postgres_fdw gains an import_stats option: running ANALYZE imports existing table statistics from the remote server instead of sampling rows over the network. Accurate row counts let the local planner choose better join methods for federated queries without transferring data just to measure it.

Developer Experience: Smaller Patterns, Cleaner SQL

Several features remove application-side workarounds. INSERT ... ON CONFLICT DO SELECT completes the get-or-create pattern: the RETURNING clause can return the existing row on conflict, so one statement either inserts or retrieves, with no second round trip and no dead tuples from the old no-op DO UPDATE SET col = EXCLUDED.col trick.

INSERT INTO users (email, name)
VALUES ('alice@example.com', 'Alice')
ON CONFLICT (email) DO SELECT
RETURNING *;

COPY can now output data as JSON directly, either as NDJSON by default or as a single array with the appropriate option, replacing row_to_json() and json_agg() pipelines with faster, streaming output. The SQL/JSON path language adds string methods such as lower(), upper(), replace(), split_part(), and btrim(). The window functions lead(), lag(), first_value(), last_value(), and nth_value() now support IGNORE NULLS, which simplifies analytical queries over sparse time-series data. Even random() gained the ability to generate random dates and timestamps within a range.

Performance That Requires No Application Changes

Several improvements speed up existing workloads automatically. Foreign key checks got a faster index-probe path, and in testing made bulk inserts nearly 2x faster in the scenarios that shipped. The planner can now convert NOT IN clauses into more efficient anti-joins when it can prove no NULL values are involved, and it can perform eager aggregation before a join, collapsing rows early so the join processes far less data. Building on the asynchronous I/O subsystem introduced in PostgreSQL 18, the default worker I/O method now automatically scales the number of I/O workers between the new io_min_workers and io_max_workers settings, replacing the fixed io_workers. There are also scalability improvements for LISTEN/NOTIFY in multi-channel workloads.

One change may surprise upgraders: just-in-time (JIT) compilation is now disabled by default. The cost estimates PostgreSQL used to decide when to compile queries proved unreliable, so short OLTP queries whose estimates drifted over the threshold paid LLVM compilation costs that outweighed the query's actual work. Teams running many large analytical queries can still enable JIT, but the default now favors the majority of workloads.

Security, Defaults, and Upgrade Considerations

PostgreSQL 19 adds server-side support for Server Name Indication (SNI), letting a single server present different TLS certificates based on the hostname a client connects to, mapped in the new pg_hosts.conf file. Password lifecycle management improves with the new password_expiration_warning_threshold setting, which warns users before their password expires.

The authentication housecleaning continues. PostgreSQL 19 now issues a warning after a successful md5 password authentication, configurable through md5_password_warnings; md5 was deprecated in PostgreSQL 18 and will be removed in a future release, so teams still using it should plan a move to SCRAM. RADIUS authentication support has been removed entirely. When PostgreSQL is built with LZ4 support, lz4 becomes the default TOAST compression method for newly compressed large values, though existing data is not automatically recompressed.

The release also widened MultiXact member offsets to 64 bits, removing a 32-bit ceiling that has caused real production outages on high-concurrency workloads with many foreign keys, since member exhaustion did not show up on standard transaction-ID monitoring dashboards.

The path to this release was notable in itself. During the beta period, the community reverted a substantial number of features, more than in any prior release, including property graph queries (SQL/PGQ), partition merge and split commands, temporal UPDATE/DELETE FOR PORTION OF, and online checksum toggling, because bugs were found before shipping rather than after. Choosing correctness over schedule is not failure; it is how a database that organizations trust with mission-critical data stays trustworthy. Several reverted features are expected to return in PostgreSQL 20.

Should You Upgrade?

PostgreSQL 19 is not a release that changes what PostgreSQL is. It changes what running PostgreSQL feels like: tables can be repacked online, a regressed plan can be pinned without touching application code, autovacuum can scale and explain itself, logical replication can be enabled without a restart and carry sequences through a cutover, and read-your-writes on standbys is a command instead of a hack. Teams on PostgreSQL 18 will find few disruptive changes beyond the new defaults worth reviewing (JIT off, lz4 TOAST compression, md5 warnings, RADIUS removal), while teams on older versions get a release that directly targets the operational pain points that motivate upgrades.

As always, validate extension compatibility and test representative workloads before migrating production systems. The release notes contain the complete list of changes, and the improvements here suggest that PostgreSQL's focus on operating at scale, quietly and reliably, is exactly where the project wants to be.

References