Re: Reduce planning time for large NOT IN lists containing NULL

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reduce planning time for large NOT IN lists containing NULL
Date: 2026-02-20 14:22:20
Message-ID: 6b3aebb5-f26c-4f50-abd6-e733d452af26@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20.02.2026 14:28, Ilia Evdokimov wrote:
> On 2/20/26 16:25, Ilia Evdokimov wrote:
>
>> I've moved the NULL check higher, placing it immediately after
>> DatumGetArrayTypeP(). This allows us to detect the presence of NULL
>> elements before decontructing the array.
>>
> Sorry, I forgot to attach the patch in my previous mail. Attaching it now.

Cool that the array code had that functionality already.

The patch looks good to me and now no longer regresses other cases. The
speedup will be less pronounced once the hash-based [NOT] IN code is
merged [1] but will still save considerable amounts of cycles.

It seems like we don't have a regression test which has a NULL value in
the NOT IN list. Maybe you can find a good place to add that one?

--
David Geier

[1]
https://www.postgresql.org/message-id/flat/7db341e0-fbc6-4ec5-922c-11fdafe7be12%40tantorlabs.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-02-20 14:22:48 Re: Interrupts vs signals
Previous Message Mahendra Singh Thalor 2026-02-20 14:10:36 Re: Non-text mode for pg_dumpall