<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc" -->

---
title: What Changes When You Upgrade from PostgreSQL 18 to 19
description: Upgrading from PostgreSQL 18.6 to 19.0 speeds up foreign-key inserts and NOT IN queries without any SQL changes. Inserting 100,000 rows into a table with a...
canonical: https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: What Changes When You Upgrade from PostgreSQL 18 to 19 | daily.dev
og:description: Upgrading from PostgreSQL 18.6 to 19.0 speeds up foreign-key inserts and NOT IN queries without any SQL changes. Inserting 100,000 rows into a table with a...
og:url: https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc
og:image: https://api.daily.dev/og/posts/IGeuDPsOc.png
og:image:alt: What Changes When You Upgrade from PostgreSQL 18 to 19
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# What Changes When You Upgrade from PostgreSQL 18 to 19

**[Hacker News](https://daily.dev/sources/hn)** · 13 min read · 0 upvotes · 0 comments

## Summary

Upgrading from PostgreSQL 18.6 to 19.0 speeds up foreign-key inserts and NOT IN queries without any SQL changes. Inserting 100,000 rows into a table with a foreign key dropped from 202.0 ms to 119.0 ms (41.1% faster). A NOT IN count over 250,000 missing IDs fell from 51.1 ms to 38.6 ms, because 19 plans it as a Hash Anti Join when both ID columns are NOT NULL. REPACK (CONCURRENTLY) rewrites a table online, shrinking a test table from 1,504 kB to 656 kB. New pg_plan_advice, ON CONFLICT DO SELECT and WAIT FOR LSN round out the changes. The author suggests staying on 18, which gets fixes through November 2030, unless one of these solves a real pain point.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://rishigoomar.com/postgresql-19-what-changes-when-you-upgrade-from-18>

## Questions this post answers

### Are foreign-key inserts faster in PostgreSQL 19 than in 18?

Yes. In a side-by-side test inserting 100,000 rows into a table with a foreign key, median time dropped from 202.0 ms on PostgreSQL 18.6 to 119.0 ms on 19.0, about 41% faster, with no SQL changes. The test used warm, ordered parent keys, and the shortcut does not apply to partitioned parents or range-based temporal foreign keys.

_Developers weighing a PostgreSQL upgrade follow benchmarks like this on daily.dev._

### Can I replace pg_repack with the REPACK command in PostgreSQL 19?

Mostly. REPACK (CONCURRENTLY) runs in plain SQL while reads and writes continue, and needs a primary key or replica identity index. It must run outside a transaction with spare disk for a table copy. Unlike pg_repack --tablespace, it cannot move a table to another tablespace, and the final swap needs a brief exclusive lock.

_Teams planning PostgreSQL maintenance jobs keep up with these tooling changes on daily.dev._

### How do I get the existing row ID back from an INSERT ... ON CONFLICT in PostgreSQL 19 without a second query?

Use ON CONFLICT (slug) DO SELECT RETURNING id. On 18, ON CONFLICT DO NOTHING RETURNING id returned nothing when the row already existed, forcing a second SELECT. In 19 one statement returns the ID on both paths without a dummy update, though the sequence still advances before the conflict check, so IDs can have gaps.

_Anyone writing idempotent inserts in Postgres can find more patterns like this on daily.dev._

## Community take

How the wider developer community reacted, aggregated from 1 discussion and 27 comments across hackernews (as of 2026-11-29).

**TL;DR:** The discussion barely touches the PostgreSQL 18→19 changes themselves and instead sprawls into tangents about a REPACK edge case, Postgres's quirks versus MS SQL, JIT defaults, and the pain of auto-updating Docker images across major versions.

**Sentiment:** 25% positive · 40% mixed · 35% skeptical

**The case for**

- Built-in REPACK (CONCURRENTLY), restart-free logical replication toggling, and JIT off by default are seen as genuinely useful operational fixes.
- Turning JIT off by default is widely welcomed since JIT misfires could unpredictably turn fast queries into multi-second ones.

**The pushback**

- Some find it unacceptable that a transaction reading right after a REPACK swap can briefly see an empty table, regardless of isolation level.
- Several feel Postgres's historical gaps (e.g. no real timezone-offset type, no easy case-insensitive indexing until recently) are embarrassing compared to other databases like MS SQL.
- Backward-incompatible major version jumps are frustrating for self-hosters and cause Docker containers pinned to 'latest' to break unexpectedly.
- One commenter notes app-dev-facing changes feel thin in 19 since bigger features (SQL/PGQ, GROUP BY ALL) were deferred to version 20.

**By community**

- hackernews (mixed): Conversation splits between appreciating operational improvements like REPACK and JIT-off-by-default, and airing broader gripes about Postgres's edge cases, timezone handling, and upgrade/versioning pain.

**Hottest debate:** Whether a transaction momentarily seeing an empty table after an online REPACK swap is an acceptable tradeoff or a fundamental flaw.

**Open questions**

- Does the empty-table-visibility issue during REPACK swaps apply uniformly across all isolation levels, or does it vary as some suggested before being corrected?
- Why hasn't Postgres adopted a true timezone-offset-preserving datetime type despite it being a known gap for years?

**Highlights**

> I am surprised that "an already-open transaction that reads events for the first time after the swap can see an empty table" is considered acceptable. I am not a Postgres user, and I appreciate that production databases are complicated beasts. Do people who use Postgres for production think this sounds fine?
> — [gwking on hackernews · 3 comments](https://news.ycombinator.com/item?id=50683284)

> Try storing datetimeoffset (ie datetime with time zone) in Postgres. It can’t. Also suppose you have a lastname and want to have case-insensitive search over it (prefix and equal). In MS SQL you just add an index. By the way, there is only one type to choose from (ignoring clustered or multicolumn) — it just works. In Postgres you needed to jump through effing hoops just for that until like 1-2 years ago when they finally added case-insensitive collation with prefix search support. — How people ignored such basic stuff for any CRUD app for years is beyond me.
> — [piskov on hackernews · 2 comments](https://news.ycombinator.com/item?id=50684369)

> The JIT default was terrible, I'm very surprised it survived that long. I really like Postgres, but that was the one rare misstep I've noticed. The JIT just hits so hard when it misfires, suddenly queries that took 100-200ms take 2 seconds because they hit the JIT threshold. And I've seen worse than that for more complex, but still usually fast queries.
> — [fabian2k on hackernews · 1 comments](https://news.ycombinator.com/item?id=50682883)

> I can always tell when a new postgres comes out because one of my docker powered apps just breaks.  The official docker for postgres attempts to do no auto update between versions and you're basically left to go figure it out yourself when `latest` breaks itself. I know there's an argument for version pinning, but I don't want to have to handhold random docker containers all the time.  It should be automated IMO.
> — [Scaled on hackernews · 4 comments](https://news.ycombinator.com/item?id=50684816)

> From an app dev perspective, 19 feels pretty quiet—especially since SQL/PGQ and GROUP BY ALL got pushed out to 20. For ops, though, it's a huge quality-of-life release. Built-in REPACK (CONCURRENTLY), turning on logical replication without a restart, and turning JIT off by default finally fix some of the biggest day-to-day operational headaches without needing external extensions or workarounds.
> — [yuuch on hackernews · 1 comments](https://news.ycombinator.com/item?id=50663562)

**Source threads**

- [hackernews](https://news.ycombinator.com/item?id=50658063) · 78 points · 27 comments

## Similar posts on daily.dev

- [Thirteen small measurements on PostgreSQL 18](https://daily.dev/posts/thirteen-small-measurements-on-postgresql-18-bwdkke2ed) · Planet PostgreSQL · 0 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#sql](https://daily.dev/tags/sql), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"What Changes When You Upgrade from PostgreSQL 18 to 19","url":"https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc"},"datePublished":"2026-11-29T00:02:00.507Z","dateModified":"2026-11-29T07:35:02.599Z","description":"Upgrading from PostgreSQL 18.6 to 19.0 speeds up foreign-key inserts and NOT IN queries without any SQL changes. Inserting 100,000 rows into a table with a...","image":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","thumbnailUrl":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,sql,postgresql","timeRequired":"PT13M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"What Changes When You Upgrade from PostgreSQL 18 to 19"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/what-changes-when-you-upgrade-from-postgresql-18-to-19-igeudpsoc#faq","mainEntity":[{"@type":"Question","name":"Are foreign-key inserts faster in PostgreSQL 19 than in 18?","acceptedAnswer":{"@type":"Answer","text":"Yes. In a side-by-side test inserting 100,000 rows into a table with a foreign key, median time dropped from 202.0 ms on PostgreSQL 18.6 to 119.0 ms on 19.0, about 41% faster, with no SQL changes. The test used warm, ordered parent keys, and the shortcut does not apply to partitioned parents or range-based temporal foreign keys. Developers weighing a PostgreSQL upgrade follow benchmarks like this on daily.dev."}},{"@type":"Question","name":"Can I replace pg_repack with the REPACK command in PostgreSQL 19?","acceptedAnswer":{"@type":"Answer","text":"Mostly. REPACK (CONCURRENTLY) runs in plain SQL while reads and writes continue, and needs a primary key or replica identity index. It must run outside a transaction with spare disk for a table copy. Unlike pg_repack --tablespace, it cannot move a table to another tablespace, and the final swap needs a brief exclusive lock. Teams planning PostgreSQL maintenance jobs keep up with these tooling changes on daily.dev."}},{"@type":"Question","name":"How do I get the existing row ID back from an INSERT ... ON CONFLICT in PostgreSQL 19 without a second query?","acceptedAnswer":{"@type":"Answer","text":"Use ON CONFLICT (slug) DO SELECT RETURNING id. On 18, ON CONFLICT DO NOTHING RETURNING id returned nothing when the row already existed, forcing a second SELECT. In 19 one statement returns the ID on both paths without a dummy update, though the sequence still advances before the conflict check, so IDs can have gaps. Anyone writing idempotent inserts in Postgres can find more patterns like this on daily.dev."}}]}
```

