where postgres is going
postgres 19's REPACK and plan advice, what got pulled, and how to follow along.
- address
- everything.deep_dives.whats_next
- part
- part 18, deep dives and interviews
- chapter
- chapter 10 of 10
- reading time
- 9 min
- version
- postgres 19
postgres 19 is at release candidate 1, with general availability planned for november 19, 2026. its headline features are REPACK, which rewrites a bloated table and can do it without blocking writes, and plan advice, a supported way to pin the planner's choices. several features that were committed for 19 were pulled again before the release.
nothing on this page runs in the browser, which is postgres 18.6. here's what changes, and how to watch it happen.
the picture
you know how a postgres feature seems to appear out of nowhere in a release announcement? it didn't. it was a patch on the pgsql-hackers mailing list, reviewed through several commitfests, committed, tested in betas, and sometimes taken back out. the whole process is public, and you can watch it.
think of a ship being fitted out in a public dry dock. you can walk past every day: parts arrive (patches), inspectors sign them off (review), they're welded in (commits), and every so often one is cut out again because it didn't pass sea trials (a revert). the launch date (the release) is announced when the hull is done.
hover a stage.
REPACK postgres 19
on postgres 18, a bloated table doesn't shrink on its own: VACUUM frees space inside the file for reuse, and only trims empty pages off the end (VACUUM). to give space back you rewrite the table with VACUUM FULL (or CLUSTER, which also sorts it), and both hold an ACCESS EXCLUSIVE lock the whole time, so nobody can even read the table. here's the 18 way, on the lab's bloat table (half its rows deleted, a tenth updated):
SELECT pg_size_pretty(pg_relation_size('bloat')) AS before;
VACUUM bloat;
SELECT pg_size_pretty(pg_relation_size('bloat')) AS after_vacuum;
VACUUM FULL bloat;
SELECT pg_size_pretty(pg_relation_size('bloat')) AS after_vacuum_full;| beforetext |
|---|
| 232 kB |
| after_vacuumtext |
|---|
| 232 kB |
| after_vacuum_fulltext |
|---|
| 120 kB |
plain VACUUM leaves the file at 232 kB. VACUUM FULL rewrites it to 120 kB, and for that whole rewrite, nothing else could touch the table.
postgres 19 adds REPACK, which the release notes describe as replacing VACUUM FULL and CLUSTER (both are kept). the REPACK docs give its shape:
REPACK bloat; -- rewrite, like VACUUM FULL
REPACK bloat USING INDEX bloat_pkey; -- rewrite in index order, like CLUSTER
REPACK (CONCURRENTLY) bloat; -- rewrite while others keep reading and writing- VACUUM FULL / CLUSTER (18)ACCESS EXCLUSIVE for the whole rewrite: no reads, no writes
- REPACK (19)the same: ACCESS EXCLUSIVE throughout
- SHARE UPDATE EXCLUSIVE while copying
- ├── copy the table into a new filechanges made meanwhile are captured with logical decoding
- ├── apply the captured changesa replication slot, limited by max_repack_replication_slots
- └── ACCESS EXCLUSIVE, brieflyapply the last changes, swap the files
the docs list what CONCURRENTLY needs: a plain heap table with a primary key or another index-based replica identity, not partitioned or unlogged, outside a transaction block, and a free repack replication slot. and one warning worth repeating: it isn't MVCC-safe, so a transaction whose snapshot predates the repack can see the table as empty afterwards. (table lock modes, logical replication and decoding).
plan advice postgres 19
postgres 18 has no query hints in core (steering the planner covers what 18 offers: statistics, enable_* settings, and the pg_hint_plan extension). postgres 19 ships two contrib modules: pg_plan_advice, "to stabilize and control planner decisions" in the release notes' words, and pg_stash_advice, which applies advice automatically per query id.
per the pg_plan_advice docs, you load the module, ask EXPLAIN for the advice that describes the plan it chose, and feed advice back in through a setting:
LOAD 'pg_plan_advice';
EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM orders AS o JOIN customers AS c ON c.id = o.customer_id;
-- Generated Plan Advice: JOIN_ORDER(...) HASH_JOIN(...) SEQ_SCAN(...) ...
SET pg_plan_advice.advice = 'JOIN_ORDER(c o) NESTED_LOOP_PLAIN(o)';- scansSEQ_SCAN(t), INDEX_SCAN(t idx), INDEX_ONLY_SCAN(t idx), BITMAP_HEAP_SCAN(t), TID_SCAN(t), DO_NOT_SCAN(t)
- join orderJOIN_ORDER(a b c), with (b c) or {b c} for sub-joins
- join methodsHASH_JOIN, MERGE_JOIN_PLAIN, MERGE_JOIN_MATERIALIZE, NESTED_LOOP_PLAIN, NESTED_LOOP_MATERIALIZE, NESTED_LOOP_MEMOIZE
- parallelism and the restGATHER, GATHER_MERGE, NO_GATHER, PARTITIONWISE, SEMIJOIN_UNIQUE
the design choices are telling. advice never makes planning fail: it only narrows the plans the planner already considers, and EXPLAIN marks each piece of advice matched, not matched, conflicting and so on. impossible advice shows up as nodes marked Disabled: true, the same marker 18 prints for enable_* settings. and it can't control aggregation strategy or set operations. the docs are blunt that pinning a plan can backfire when the data changes, which is the same lesson as the casebook: fix the estimate first.
the rest of 19, as it touches this book
from the release notes' overview and the sections behind it, the changes that land on earlier chapters:
- I/Oio_method = worker now scales its own worker processes; EXPLAIN ANALYZE gets an IO option
- autovacuumparallel index vacuuming; a scoring system picks which table goes first (pg_stat_autovacuum_scores)
- visibility mapordinary table scans can now mark pages all-visible
- foreign keysfaster foreign-key checks
- replicationlogical replication of sequences; logical decoding without a restart when wal_level = replica
- read your writesa WAIT command makes a standby wait until it has replayed a given LSN
- SQLINSERT ... ON CONFLICT DO SELECT ... RETURNING; IGNORE NULLS for lag, lead, first_value, last_value, nth_value
- defaultsjit off; default_toast_compression lz4; max_locks_per_transaction 128; standard_conforming_strings always on
so on 19: async I/O tunes itself, autovacuum can use parallel workers, the visibility map gets set by reads too (good news for index-only scans), read replicas get a built-in way to read your own writes, upserts can return the existing row, and window functions can skip NULLs. JIT, which the column store chapter turned off by hand for its measurements, is off by default. read the incompatibilities section before upgrading: RADIUS authentication is removed, and dumps made with standard_conforming_strings = off won't load.
what got pulled
a commit isn't a release. during the 19 betas, post-commit review turned up enough problems that several features were reverted, each with the reason in the commit message. the four biggest, from the postgres repository:
| feature | reverted | why, from the commit |
|---|---|---|
GROUP BY ALL | 2026-07-17 | wrong results with ORDER BY entries that use non-default equality; "we'll revert and try again in v20" |
ALTER TABLE ... MERGE/SPLIT PARTITION(S) | 2026-08-26 | "multiple design issues which are too late to address in this release cycle" |
SQL property graph queries (SQL/PGQ, GRAPH_TABLE) | 2026-09-07 | the feature and the fixes built on it, all reverted |
UPDATE/DELETE ... FOR PORTION OF | 2026-09-15 | the feature and its follow-up fixes, all reverted |
the beta 4 announcement draft on pgsql-hackers put it as the community choosing to defer some features to a future major release. for this book, FOR PORTION OF is the one that hurts: it was the other half of the temporal keys story (WITHOUT OVERLAPS keys shipped in 18, temporal updates were meant to follow). it's a good reminder of the rule this book has followed throughout: a feature is real when it's in a release, not when it's committed.
how to follow along
- pgsql-hackers, the development mailing list: every patch, review and design argument, including the threads behind the reverts above. the archives are public and searchable.
- the commitfest app: patches waiting for review, organized into month-long commitfests. reviewing one (apply it, test it, report back on the list) is the most useful way for a newcomer to help.
- planet postgresql: an aggregator of blogs by postgres developers and users, where new features usually get their first long explanations.
- the release notes and the beta and release candidate announcements: the betas exist so people test their own workloads before the release, and say so on the list when something breaks.
keylines
- postgres 19: rc1 on 2026-10-15, general availability planned for 2026-11-19.
- REPACK replaces VACUUM FULL and CLUSTER; REPACK (CONCURRENTLY) rewrites without blocking writes.
- pg_plan_advice: EXPLAIN (PLAN_ADVICE) prints advice, pg_plan_advice.advice applies it. it narrows choices, never fails planning.
- GROUP BY ALL, MERGE/SPLIT PARTITION, SQL/PGQ and FOR PORTION OF were committed and then reverted.
- follow pgsql-hackers, the commitfest app and planet postgresql. a feature is real when it's released :)