PostgreSQL 19: Concurrent REPACK, Replicas, Planner Controls
PostgreSQL 19 adds concurrent REPACK, replica consistency improvements, and query-planning controls. What to check before migrating.

PostgreSQL 19 became generally available on November 19, 2026. The new major release adds a built-in table-repacking command, a way to make reads from asynchronous replicas wait for a specific committed write, new controls over query-planner decisions and a collection of SQL, replication and monitoring improvements.
The PostgreSQL Global Development Group lists version 19.0 as the current major release. Its most consequential changes are not a single headline speed boost. They address operational friction: reclaiming table space with less disruption, avoiding stale reads after writes, understanding database activity and controlling query plans when the planner's choices become problematic.
For administrators, the release also brings compatibility changes. PostgreSQL 19 should be treated as a major-version migration, not a routine patch update.

REPACK can reorganize tables while work continues
PostgreSQL 19 introduces REPACK, which rewrites a table to reclaim storage occupied by dead tuples. It can also reorder rows using an index. The command is intended to address table bloat and improve physical data organisation.
The key option is CONCURRENTLY. Without it, REPACK takes an ACCESS EXCLUSIVE lock for the operation. With REPACK (CONCURRENTLY), most of the work runs under a less restrictive SHARE UPDATE EXCLUSIVE lock, allowing other transactions to continue using the table. PostgreSQL captures concurrent changes while it builds replacement table and index files, applies those changes, then takes an ACCESS EXCLUSIVE lock for the final swap.
That final step matters. “Without blocking writes” is a useful shorthand for the feature's main benefit, but it does not mean the operation never takes a strong lock. The final swap still needs one, and a busy workload can affect how easily it is acquired. The documentation also warns that concurrent repacking can fail after much of the work has been done, especially on busy tables.
The project says REPACK replaces the roles commonly served by VACUUM FULL and CLUSTER; both older commands remain available for compatibility. It is not a replacement for routine vacuuming. PostgreSQL recommends VACUUM for transaction-ID wraparound prevention because rewriting a whole table and its indexes is slower and can fail.
The user needs the MAINTAIN privilege on the table. Progress is exposed through the new pg_stat_progress_repack view.
WAIT FOR LSN brings read-your-writes consistency to replicas
Applications often send writes to a primary database and distribute read queries across standby servers. With asynchronous replication, a committed write may not yet have been replayed on a standby when the next read arrives. The result can be a stale response even though the write succeeded.
PostgreSQL 19 adds the top-level SQL command WAIT FOR LSN to address this. After a transaction commits on the primary, an application can obtain a write-ahead-log location (an LSN) and pass it to a standby. The standby waits until it has reached that point before the application issues its read.
The default standby-replay mode waits until the relevant WAL has been replayed and the changes are visible. Other modes can wait for WAL to be written or flushed, while primary_flush applies to a primary server. The command supports a timeout and a NO_THROW option for applications that want to handle timeout or promotion outcomes as status values.
This is not automatic consistency for every replica query. The LSN must identify a point at or after the commit record for the transaction in question, and the application or connection pooler must retain that position. WAIT must run as a top-level command and cannot run after the current transaction has acquired a snapshot. It is a coordination primitive that applications must integrate deliberately.

Planner advice offers control, with trade-offs
PostgreSQL's query planner chooses execution plans using statistics and estimated costs. Those choices can change as data distributions shift, and a plan that was once fast can become slower.
Version 19 adds pg_plan_advice, which can describe, reproduce and constrain selected planner decisions through a dedicated advice language. Administrators can inspect choices with EXPLAIN (PLAN_ADVICE), then apply selected advice to influence join order, join methods or scan methods. The companion pg_stash_advice extension stores advice by query identifier and applies it to matching queries.
This is not a universal query optimiser. PostgreSQL warns that constraining the planner can backfire when underlying data changes. Advice can only influence plans the core planner considers viable; it cannot force a semantically invalid or otherwise rejected plan. Teams should measure changes against representative workloads and monitor them as data evolves.
The release also improves planner transformations, including converting eligible NOT IN expressions into anti-joins when NULL semantics permit it, and moving some aggregation work ahead of joins to reduce the number of rows processed. These changes can help particular query shapes; they do not promise a uniform speed-up for every application.
The nearly 2x insert claim needs context
The PostgreSQL project's announcement says improvements to foreign-key constraint checks made bulk inserts nearly twice as fast in testing. That result is tied to workloads where foreign-key checks are relevant. It should not be read as a claim that every bulk insert, database or application will run twice as fast.
The public announcement does not provide a full benchmark methodology alongside the headline figure: it does not specify the test dataset, hardware, schema, batch size or comparison conditions in that statement. The release notes document the foreign-key-check improvements, but the performance multiple remains an attributed project result rather than a result independently reproduced for this report.
Other performance work includes improved asynchronous I/O read-ahead scheduling, automatic adjustment of I/O worker counts when io_method = 'worker', parallel vacuuming of indexes, and improvements to COPY FROM for text and CSV data. The default TOAST compression method also changes to LZ4 when the build includes LZ4 support.
A simpler get-or-create pattern
Developers gain INSERT ... ON CONFLICT DO SELECT, which lets an insert return the existing row when a unique constraint or index detects a conflict. Combined with RETURNING, it supports an atomic insert-or-select operation for common get-or-create patterns. The existing DO NOTHING and DO UPDATE actions remain available.
The new form still depends on a suitable unique index or constraint, and a RETURNING clause is required. It can optionally lock the conflicting row. This can remove application-level retry or follow-up lookup logic in some cases, but applications must still consider transaction boundaries, locking and concurrency.
Other additions include JSON output modes for COPY, string methods in SQL/JSON path expressions, IGNORE NULLS support for several window functions, and random date and timestamp generation within a range.
Monitoring and replication improvements
PostgreSQL 19 adds monitoring views including pg_stat_lock for per-lock-type statistics, pg_stat_recovery for recovery status and pg_stat_autovacuum_scores for insight into how autovacuum prioritises tables. EXPLAIN ANALYZE gains an IO option to report asynchronous I/O activity, and WAL written for full-page images is exposed in additional statistics and logging output.
Logical replication gains sequence-value replication. PostgreSQL can also raise the effective WAL level to logical when the first logical replication slot is created under the documented configuration, reducing the need for a restart in that setup. Publication and subscription options add more control over replicated objects and concurrent-delete conflicts.
What administrators should check before upgrading
PostgreSQL 19 is a major release. The project says migration requires a dump and restore, pg_upgrade, or logical replication. Administrators should review the complete migration notes and test extensions, clients, schema and operational procedures before production rollout.
Several changes deserve particular attention:
- I/O worker settings: the old
io_workerssetting is removed and replaced byio_min_workers,io_max_workers,io_worker_idle_timeoutandio_worker_launch_interval. - JIT: just-in-time compilation is disabled by default. Systems running large analytical queries that relied on JIT should review and explicitly configure it where appropriate.
- Authentication: successful MD5 password authentication now produces a warning; MD5 was deprecated in PostgreSQL 18. RADIUS authentication support has been removed. The project recommends SCRAM for password-based authentication.
- Lock capacity: the default
max_locks_per_transactionincreases from 64 to 128. The release notes explain that settings need to be doubled to match the previous capacity. - String handling and dumps:
standard_conforming_stringsis forced on at the server. Dumps created by olderpg_dumporpg_dumpallversions while that setting was off may not load correctly. The migration notes recommend creating dumps with PostgreSQL 19 tools or with the setting enabled. - Other compatibility changes: restrictions on carriage returns and line feeds in database, role and tablespace names, and changes to foreign-data-wrapper transaction behaviour may affect particular deployments.
The PostgreSQL versioning policy lists PostgreSQL 19 as supported, with a first release date of November 19, 2026 and a scheduled final release date of November 19, 2031. The project publishes the full release notes and migration instructions for teams planning an upgrade.
A substantial release, not a blanket performance promise
PostgreSQL 19's strongest changes address practical operational friction: table maintenance with less disruption, explicit consistency when reading from asynchronous replicas, more visibility into database activity, and additional control over planner decisions. The new SQL conflict action also removes a common round trip from some application patterns.
The performance claims need to be read in context. The nearly 2x insert result is tied to foreign-key-check improvements in the project's testing, while planner and I/O gains depend on workload and configuration. The new maintenance and planning controls bring their own operational considerations.
For production teams, the immediate next step is not to upgrade solely for a benchmark headline. It is to read the migration notes, test PostgreSQL 19 against a representative workload, review changed defaults and removed features, and validate application paths that use replicas, foreign keys and table maintenance.
AI-assisted content
This story was drafted and/or edited with AI assistance and reviewed before publishing.
Explore more topics
Related stories

Multi-Tenant Architecture in SaaS: Isolation Models, Security and Scaling
A practical guide to multi-tenant architecture in SaaS: compare silo, bridge and pooled models, design tenant-aware identity and data access, and prevent cross-tenant leaks across databases, APIs, caches, storage and background jobs.