PostgreSQL: Query Optimizer Gets Smarter with NOT IN Magic

Today's PostgreSQL update brings a major query optimization breakthrough with Richard Guo's work converting NOT IN subqueries to anti-joins when safe, plus important improvements to CHECK constraint management and buffer handling. We also see streaming read optimizations for VACUUM operations and several buffer management refinements that collectively boost performance across the board.

Duration: PT3M56S

Episode overview

This episode is a short developer briefing from PostgreSQL.

It explains recent repository work in plain language.

  • Show: PostgreSQL
  • Published: 2026-03-12T10:04:39Z
  • Audio duration: PT3M56S

Transcript excerpt

This excerpt keeps the crawler page concise. Listen to the episode or use the RSS feed for the full update.

Hey there, PostgreSQL enthusiasts! Welcome back to another episode of our daily dive into the world's most advanced open source database. I'm your host, and wow, do we have some exciting stuff to unpack today from March 12th.

You know that feeling when you write a query with NOT IN and it just... crawls? Well, Richard Guo just gave us a Christmas present in March with a absolutely brilliant optimization. He's taught the PostgreSQL query planner how to convert "NOT IN" subqueries into anti-joins when it's safe to do so.

Now, this might sound like database wizardry, but here's the story in simple terms. Traditionally, when you write something like "SELECT customers WHERE id NOT IN (SELECT customer_id FROM banned_users)", PostgreSQL has had to handle this very conservatively because of how SQL handles NULL values. The planner…

But Richard figured out something clever - if we can prove that neither side of the comparison can be NULL, and the operator itself won't return NULL, then NOT IN and anti-joins behave identically. This unlocks the planner to treat your subquery as a first-class citizen in join ordering optimization. The result?…

Speaking of making things better, Jian He, with…

On…

Nearby episodes from PostgreSQL

  1. SQL Property Graphs Land with a Bang
  2. Foundation Fixes and Platform Polish
  3. Performance Revolution - SIMD Powers and Index Optimizations
  4. Performance Week - Smart Domains & Lightning-Fast Indexes
  5. The REPACK Revolution
  6. Optimizing the Engine from the Inside Out
  7. When Booleans Go Wrong
  8. Major Auth Upgrade and Subscription Revolution