Hi! On Mon, Nov 13, 2023 at 9:48 PM a.rybakina <a.rybak...@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_q3xbf2wlm...@mail.gmail.com ------ Regards, Alexander Korotkov