PostgreSQL 19 release: REPACK, plan advice and what breaks
PostgreSQL 19 was released on 19 November 2026. It adds REPACK (CONCURRENTLY) for online bloat cleanup, plan advice extensions, INSERT ... ON CONFLICT DO SELECT and WAIT FOR LSN for read-your-writes on standbys. It also disables JIT by default, removes RADIUS, forces standard_conforming_strings on and doubles max_locks_per_transaction.
The PostgreSQL Global Development Group released PostgreSQL 19 on 19 November 2026. The headline for operators is REPACK (CONCURRENTLY), which removes table bloat without blocking reads and writes, so for many teams it replaces pg_repack or a maintenance window. For application developers there is INSERT ... ON CONFLICT DO SELECT, plan advice for fixing a bad query plan without a code change, and WAIT FOR LSN for reading your own writes on a replica. The release notes also list 22 incompatibilities, some of which can stop pg_upgrade or change query results, so read them before you schedule anything.
REPACK replaces VACUUM FULL and CLUSTER
REPACK rewrites a table to reclaim space and can reorder it by an index. VACUUM FULL and CLUSTER still exist for compatibility but are superseded. The important part is the CONCURRENTLY option:
-- Rewrite a bloated table without blocking reads or writes
REPACK (CONCURRENTLY, VERBOSE) orders;
-- Same, ordered by the index used last time (effectively CLUSTER)
REPACK (CONCURRENTLY) orders USING INDEX;Without CONCURRENTLY, REPACK holds an ACCESS EXCLUSIVE lock for the whole run. With it, most of the work happens under SHARE UPDATE EXCLUSIVE and the exclusive lock is taken only to swap files at the end. The documentation lists caveats worth knowing before you run it on a production table:
- It needs free disk space for a full copy of the table plus its indexes.
- The table must have a primary key or index-based replica identity, must be a regular
heaptable, and cannot be partitioned, unlogged or a system catalog. - Concurrent changes are captured through logical decoding, so
max_repack_replication_slotsmust allow one more slot. The command fails if more than about 104 million rows are updated or deleted while it runs. - It is not MVCC-safe: a transaction holding a snapshot from before the repack started will see the table as empty after it commits. Avoid running it alongside long-running reporting transactions on the same table.
- It can't run inside a transaction block, and it can fail if other sessions run DDL on the table.
Other features worth knowing
Plan advice. The new pg_plan_advice extension lets you steer plan choices with a "plan advice" mini-language, and pg_stash_advice stores advice and applies it automatically by query identifier. That gives you a way to fix a regressed plan from the database side without changing the application.
INSERT ... ON CONFLICT DO SELECT. RETURNING can now return the existing row that caused the conflict, which turns "get or create" into a single statement:
INSERT INTO tags (name) VALUES ('postgres')
ON CONFLICT (name) DO SELECT
RETURNING id;According to the INSERT reference, DO SELECT requires both a conflict target and a RETURNING clause. You can add FOR UPDATE (or another row lock) to lock the existing row, and a WHERE condition to filter which conflicting rows are returned.
Read-your-writes on replicas. WAIT FOR LSN makes a session on a standby wait until it has replayed WAL up to a given position. An application can record the primary's LSN after a write and have the replica wait for it before reading.
Logical replication without a restart. The effective WAL level is raised to logical automatically when the first logical replication slot is created; effective_wal_level shows what is in use. Publications gain FOR ALL SEQUENCES and an EXCEPT clause for FOR ALL TABLES.
Smaller additions. COPY can output JSON. Window functions lead(), lag(), first_value(), last_value() and nth_value() accept IGNORE NULLS. Autovacuum can vacuum indexes with parallel workers (autovacuum_max_parallel_workers), and new views pg_stat_lock, pg_stat_recovery and pg_stat_autovacuum_scores help with monitoring. The server can present different TLS certificates per hostname using SNI, configured in pg_hosts.conf.
Performance. The announcement reports bulk inserts with foreign key checks nearly twice as fast in the project's testing, NOT IN converted to anti-joins when no NULLs are present, and eager aggregation before joins (enable_eager_aggregate).
The incompatibilities to check first
The full list is in the release notes' migration section. These are the ones most likely to affect a typical application or upgrade:
| Change | What to do |
|---|---|
| JIT is disabled by default | If you run large analytical queries that benefited from JIT, set jit = on and compare timings. |
standard_conforming_strings is always on | Dumps made by older pg_dump with it off won't load correctly. Dump with PostgreSQL 19 tools. |
| RADIUS authentication removed | Move those users to another method before upgrading. |
md5 login now logs a warning | Plan the move to SCRAM; md5 will be removed in a future release. md5_password_warnings silences it. |
max_locks_per_transaction default 64 → 128 | Lock allocation changed, so double any explicit setting to keep the same capacity. |
io_workers removed | Replace it with the new settings, such as io_min_workers and io_max_workers. |
inet/cidr default opclass changed | pg_upgrade refuses clusters with btree_gist indexes on these types. Rebuild them first. |
| CR/LF in database, role or tablespace names | Now disallowed; pg_upgrade refuses such clusters. Rename first. |
json_array() over no rows returns [] | Code that checked for NULL needs updating. |
Full text search and pg_trgm use the database's locale provider | After pg_upgrade, reindex affected indexes and recompute stored tsvector values. |
| Parallel vacuum shares one cost limit | Parallel VACUUM with cost-based delay may run slower than before. |
Monitoring dashboards need a look too: pg_stat_subscription_stats.sync_error_count is now sync_table_error_count, and several wait events were renamed (BufferPin is now BufferCleanup, and BufferContent is split into three).
How to approach the upgrade
As with every major release, moving to 19 requires pg_dumpall and restore, pg_upgrade, or logical replication. A sensible order:
- Search your configuration and infrastructure code for
io_workers,max_locks_per_transaction,jitandradiusinpg_hba.conf. - Run
pg_upgrade --checkagainst a copy of production to catch the opclass and naming blockers early. - Grep application code for
json_array(and check how aNULLresult is handled. - Rerun your heaviest analytical queries with and without JIT.
- After the upgrade, reindex full text search and
pg_trgmindexes if your database's locale provider differs from libc.
These are good candidates to split into separate, reviewable changes rather than one large upgrade branch: a config change, a code fix for json_array(), a reindex migration. Small, well-scoped pull requests are also easier to hand to a coding agent; if you use CodeBeast, How a task runs explains how each one goes from a description to a reviewed pull request.
Sources
FAQ
When was PostgreSQL 19 released?
PostgreSQL 19.0 was released on 19 November 2026. Upgrading from an earlier major version needs pg_dumpall and restore, pg_upgrade, or logical replication.
Does REPACK replace pg_repack?
For many cases, yes. REPACK (CONCURRENTLY) rebuilds a table without blocking reads and writes, which is what most teams used the pg_repack extension for. It has restrictions: the table needs a primary key or index-based replica identity, can't be partitioned or unlogged, and needs free space for a full copy.
Why is JIT disabled by default in PostgreSQL 19?
The release notes say the cost estimates used to decide when to apply JIT proved unreliable. Sites running many large analytical queries can turn it back on with jit = on and should measure the difference.
Will pg_upgrade to PostgreSQL 19 fail on my cluster?
It refuses clusters that have btree_gist indexes on inet or cidr columns, or database, role or tablespace names containing carriage returns or line feeds. Run pg_upgrade --check on a copy first to find these.
Written by the CodeBeast Team with AI assistance. Spotted a mistake? Email support@codebeast.ai.