hn.today

What Changes When You Upgrade from PostgreSQL 18 to 19

rishigoomar.com4 points0 comments
Screenshot of What Changes When You Upgrade from PostgreSQL 18 to 19

PostgreSQL 19’s practical gains include faster bulk inserts with foreign keys and improved planning for certain `NOT IN` queries. In tests comparing 18.6 and 19.0, inserting 100,000 rows with a foreign key took 119 ms instead of 202 ms, while the same insert without the constraint improved only slightly. The foreign-key improvement came from checking the parent’s unique index directly; it does not cover partitioned parents or temporal foreign keys, and child-side indexes remain important for deletes. A query finding missing IDs ran 24.5% faster because PostgreSQL 19 converted eligible `NOT IN` queries into a Hash Anti Join. That rewrite is unavailable when nullable values could change `NOT IN`’s meaning.

The upgrade also adds a built-in concurrent `REPACK` command to reclaim disk space without blocking ordinary reads and writes, though it needs extra disk capacity and a brief exclusive lock for its final swap. New planner-advice modules let developers inspect and test alternate query plans, and `ON CONFLICT DO SELECT` can return an existing row without a second query. `WAIT FOR LSN` lets applications wait for a replica to replay a recent write before reading it. Before upgrading, test a restored database, verify extension compatibility, remove the obsolete `io_workers` setting, benchmark analytical workloads because JIT is disabled by default, and review custom lock settings because the default lock capacity has doubled.

Read on rishigoomar.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Lua as a Query Language

Lua as a Query Language

Lua can serve as a dynamic query language by expressing relational operations as Lua code that builds an AST for a Rust backend, avoiding a custom parser and Rust recompilation for ad hoc queries. Lua variables provide reusable views and built-in language features support query constructs such as filters and arithmetic. (remy.wang)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.