A single NULL turns NOT IN into a query that silently returns zero rows, and the planner couldn't optimize around it for as long as anyone can remember, until a PostgreSQL 19 patch fixed that.

https://boringsql.com/posts/not-in-null/

The NULL in your NOT IN

A single NULL turns NOT IN into a query that silently returns zero rows, and the planner couldn't optimize around it for 25 years, until a PostgreSQL 19 patch.

boringSQL | Supercharge your SQL & PostgreSQL powers