Re: POC, WIP: OR-clause support for indexes - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: POC, WIP: OR-clause support for indexes
Date
Msg-id CAPpHfdtZkuJ_XKPyDw2re507nc6+sp=8dEexzZu708i=4uxz9Q@mail.gmail.com
Whole thread Raw
In response to Re: POC, WIP: OR-clause support for indexes  ("a.rybakina" <a.rybakina@postgrespro.ru>)
Responses Re: POC, WIP: OR-clause support for indexes
List pgsql-hackers
Hi!

On Mon, Nov 13, 2023 at 9:48 PM a.rybakina <a.rybakina@postgrespro.ru> wrote:
> These days I was porting a patch for converting or expressions to ANY to
> the choose_bitmap_and function. Unfortunately, it is not possible to
> transfer the conversion there, since expressions are processed one by
> one, as far as I saw. Therefore, I tried to make the conversion earlier
> in the generate_bitmap_or_paths function, there is just a loop bypass.
> The patch turns out to be quite complicated, in my opinion, and to be
> honest, it does not work fully yet. Also, due to the fact that the index
> for the ScalarOpExpr expression is created earlier (approximately 344
> lines in the src/backend/optimizer/path/indxpath.c file), we had to call
> the generate_bitmap_or_paths function earlier. I haven't seen yet what
> problems this could potentially lead to. Patch in the attached diff file.

It seems to me there is a confusion.  I didn't mean we need to move
conversion of OR-expressions to ANY into choose_bitmap_and() function
or anything like this.  My idea was to avoid degradation of plans,
which I've seen in [1].  Current code for generation of bitmap paths
considers the possibility to split OR-expressions into distinct bitmap
index scans.  But it doesn't consider this possibility for
ANY-expressions.  So, my idea was to enhance our bitmap scan
generation to consider split values of ANY-expressions into distinct
bitmap index scans.  So, in the example [1] and similar queries
conversion of OR-expressions to ANY wouldn't affect the generation of
bitmap paths.

Links
1. https://www.postgresql.org/message-id/CAPpHfduJtO0s9E=SHUTzrCD88BH0eik0UNog1_q3XBF2wLmH6g@mail.gmail.com

------
Regards,
Alexander Korotkov



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop.