Re: BUG #18851: Queries with xxx NOT IN (SELECT xxx FROM table) fail to run (or run very slowly) on v17 (v14 ok)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: joan@sanchezsabe.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-03-14T16:56:54Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> I have experienced a misbehaviour (IMHO) in PostgreSQL 17 that didn't occur
> in PostgreSQL 14.

What have you got work_mem set to in the two installations?

For me, both versions switch to the cheap hashed plan if work_mem
is large enough that the inner table is estimated to fit in it
(somewhere around 10MB-20MB for this specific example).  If anything
the newer code seems to have a smaller threshold.

			regards, tom lane