Blog
IntermediateReferenceDatabases

PostgreSQL 19 performance changes - planner rewrites, executor speedups and what upgrades quietly change

The PostgreSQL 19 changes that do not each rate their own page - NOT IN to anti-join rewriting, aggregate-before-join planning, radix sort and SIMD parsing, faster foreign-key checks, visibility-map writes from scans, and the statistics tooling - and which ones can change plans on upgrade.

Applies to
PostgreSQL19PostgreSQL 19.0 was released on 19 November 2026; the list below is checked against the GA release notes.
growingUpdated Reviewed

These are the changes too small for their own pages, grouped by whether they cost you anything. The I/O worker autoscaling that is also part of the performance story is covered on the asynchronous I/O page.

“Will my plans change?” - the rewrite rules

The planner now rewrites more of your SQL before costing it. Each is a win in expectation and a diff in practice - EXPLAIN output that differs from an 18 baseline is usually this list working, not a regression:

  • NOT IN becomes an anti join when NULLs cannot occur (non-nullable columns, or constraints proving it). Anti joins plan and execute better than the NOT IN fallback, but the plan shape - and the text EXPLAIN prints - is different.
  • More LEFT JOINs convert to anti joins where the query only asks whether a match exists, and Memoize now applies to anti joins with unique inner sides - repeated existence probes cache instead of rescanning.
  • Some aggregation runs before joins - counting or summing a side before joining it reduces the rows the join must carry. New plan shapes for reporting queries.
  • Append/MergeAppend can now use explicit incremental sorts, and semijoin planning is improved generally.
  • A family of expression simplifications: IS [NOT] DISTINCT FROM NULL folds to IS [NOT] NULL, IS [NOT] DISTINCT FROM becomes plain equality when both sides are proven non-nullable, var IS NULL folds earlier, COALESCE() and ROW(...) IS NULL skip arguments they cannot need, and IS [NOT] TRUE/FALSE/UNKNOWN simplifies on non-nullable inputs. None changes results; all make the expression tree smaller and more optimisable.
  • The planner now weighs startup costs of partial paths - the time-to-first-row estimate is part of path selection, not just total cost.

“What got faster without me doing anything?” - executor and WAL-adjacent work

  • Foreign-key constraint checks are faster - every INSERT, UPDATE and DELETE against a referenced table pays this; write-heavy workloads against referenced parents gain the most.
  • Sorting uses radix sort where applicable.
  • COPY FROM text and CSV parsing uses SIMD CPU instructions, as do hex_encode/hex_decode; internal row deformation and UTF-8 case folding are faster. Bulk loads and text-heavy parsing benefit without a setting change.
  • NOTIFY wakes only backends listening on the notified channel - previously most backends woke on any notification; systems using LISTEN/NOTIFY for job queues stop paying wakeup tax per notification.
  • hash index bulk deletion and GIN vacuuming use streaming reads, matching the read pattern the async I/O work assumes.

“What is different about the buffer and visibility machinery?”

  • Sequential table scans can now set the visibility-map all-visible bit themselves. Before 19, only VACUUM (or COPY FREEZE at load) could mark a page all-visible, which is what enables index-only scans; a scanned table now moves toward index-only eligibility without waiting for the vacuum cycle.
  • TID range scans can be parallelised - queries that scan ctid ranges (some vacuum and sampling tools do) can spread over workers.
  • timing_clock_source is a new GUC choosing the timing source, relevant to EXPLAIN (ANALYZE, TIMING) and pg_test_timing - on platforms where clock reads are costly, the timing overhead reported by ANALYZE can be reduced.

“What changed in statistics?”

  • Extended statistics on virtual generated columns are now allowed - CREATE STATISTICS can cover them, so estimates on generated expressions can stop falling back to selectivity guesses.
  • pg_restore_extended_stats() restores extended statistics objects (used by pg_dump), and pg_clear_extended_stats() clears them for a fresh rebuild.
  • Join selectivity computations are faster at large default_statistics_target values - the statistics target you raised for better estimates costs less planning time.
  • Boolean-returning functions get genuine planner statistics rather than a generic estimate.
  • pg_aggregate.aggtransspace accepts negative values meaning unbounded aggregate memory, which the planner uses when costing aggregation memory.

“Do any of these need action before or after the upgrade?”

Two do, and they are also in the overview’s upgrade checklist:

  • JIT is off by default. Previously enabled with cost-based activation; the costing proved unreliable. Large analytical workloads that benefited need jit = on set deliberately.
  • max_locks_per_transaction defaults doubled (64 to 128) because lock entry sizing changed - a tuned value must be doubled, not carried over.

The rest of the list needs no action - but if you regression-test plans, expect diffs in anti-joinable NOT IN queries and aggregate-heavy reporting, and confirm they are improvements rather than assuming the plan changed for a reason you need to find.

What changed, and in which release

Change PG 18 and earlier PG 19
NOT IN planning NOT IN evaluated as-is; NULL semantics forced a slower shape Anti-join rewrite when NULLs are impossible
Aggregate-then-join Aggregates costed after joins Some aggregation pushed below the join
Visibility-map maintenance Only VACUUM / COPY FREEZE set all-visible Sequential scans set it too
NOTIFY wakeup Most backends woke per notification Only listeners on the channel wake
JIT default On, cost-gated Off; set jit = on deliberately
Extended stats on virtual generated columns Not allowed Allowed
LOCK TABLE contention visibility Not measurable Not here - that is pg_stat_lock, on the monitoring page

Where it breaks

  • Pinned plans and documented plans diverging from reality - runbooks and pg_stash_advice entries written against 18 plan shapes can silently mismatch; check the EXPLAIN feedback the plan advice page describes for failed or inapplicable.
  • Assuming a faster NOT IN means the schema can stay NULLable - the rewrite only applies when NULLs cannot occur; a NOT NULL constraint is what unlocks it.
  • Timing comparisons between releases - timing_clock_source means measured execution timing can differ from clock-source choice, not only from speed.
  • Assuming identical plans post-upgrade - the planner rewrites below (NOT IN to anti join, aggregate pushdown, expression simplification) are real changes, so a plan pinned in a runbook or pg_stash_advice can legitimately differ after the upgrade.

What this is not for

  • Tuning - this is the change inventory, not the tuning guide; the statistics and EXPLAIN changes are tools, and which knobs to turn is workload work.
  • The I/O worker autoscaling - that has its own page: asynchronous I/O.

PostgreSQL release support

5 supported
ReleaseLatestReleased
1919.0Nov 2026
1818.7Sept 2025
1717.12Sept 2024
1616.16Sept 2023
1515.20Oct 2022

Data as of 2026-11-21 from endoflife.date. Refresh with node scripts/fetch-versions.mjs.

What to watch

Specific things that would change what this page concludes.

  • JIT shipped disabled by default - whether a point release revisits the costing, and whether distributions override the default

Where PostgreSQL sits

How this component relates to the rest of the stack. Items without a link are not covered here yet.

Depends on

Must be present for this to run

Deployed with

Commonly run alongside

Alternatives

Solves a similar problem differently