public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ilia Evdokimov <[email protected]>
To: David Geier <[email protected]>
To: PostgreSQL Developers <[email protected]>
Subject: Re: Reduce planning time for large NOT IN lists containing NULL
Date: Fri, 20 Feb 2026 16:25:24 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
On 2/20/26 12:06, Ilia Evdokimov wrote:
> There is already ARR_HASNULL() which allows us to detect the presence
> of NULL in ArrayType.
>
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.
I tested this with several queries of the form:
WHERE x NOT IN (NULL, ...)
In my tests (with column x having detailed statistics, so selectivity
estimation performs more work), planning time decreases from *5-200 ms
before the patch* to *~ 1-2 ms after the patch*, depending on the list size.
--
Best regards.
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Reduce planning time for large NOT IN lists containing NULL
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox