public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jim Vanns <[email protected]>
To: pgsql-general <[email protected]>
Subject: BitmapOr node not used in plan for ANY/IN but is for sequence of ORs ...
Date: Tue, 12 Nov 2024 12:43:26 +0000
Message-ID: <CAH7vdhO_JPN33FVMi_NaHs-YgSh6FHmORtncPtjjq7QcJVV=tw@mail.gmail.com> (raw)
In PG16.4, we have a table of key/pair data (around 30M rows) where there
are about 7 distinct keys and each has a conditional or partial index on
them (the distribution is different for each key/value pair combination).
I've found that when we have a query that uses an OR then those partial
indexes are used but not if the query is written to use ANY/IN, which is
more convenient from a programmer POV (especially any with 3rd party query
generators etc.). Naturally, the result sets returned by the queries are
identical due to the filter semantics of any of the 3 solution variants.
Here's a shareable, MRP;
https://dbfiddle.uk/OKs_7HWv
Is there any trick I can do to get the planner to make use of the
conditional/partial index? Or is this simply an unoptimised code path yet
to be exploited!?
Cheers,
Jim
--
Jim Vanns
Principal Production Engineer
Industrial Light & Magic, London
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]
Subject: Re: BitmapOr node not used in plan for ANY/IN but is for sequence of ORs ...
In-Reply-To: <CAH7vdhO_JPN33FVMi_NaHs-YgSh6FHmORtncPtjjq7QcJVV=tw@mail.gmail.com>
* 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