Re: Bitmap reuse - Mailing list pgsql-hackers

From David Rowley
Subject Re: Bitmap reuse
Date
Msg-id CAApHDvopTfKCFb=s-+s7jEd3T8hLFKNQUser=U_q4StaUV2i-w@mail.gmail.com
Whole thread Raw
In response to Re: Bitmap reuse  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bitmap reuse  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, 21 Jul 2021 at 11:25, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Jeff Janes <jeff.janes@gmail.com> writes:
> > For some queries PostgreSQL can spend most of its time creating the exact
> > same bitmap over and over.  For example, in the below case: (also attached
> > as a file because line-wrapping is going to make a mess of it)
>
> Uh .... it's not the "exact same bitmap each time", because the selected
> rows vary depending on the value of g.i.

I imagined Jeff was meaning the bitmap from the scan of foo_x_idx, not
the combined ANDed bitmap from both indexes.

I didn't look in detail, but I'd think it would just be a matter of
caching the bitmap then in ExecReScanBitmapIndexScan(), if the
PlanState's chgParam indicate a parameter has changed, then throw away
the cache.  Then if the cache is still valid in
MultiExecBitmapIndexScan(), return it.  Not too sure about the memory
context part for the cache. As I said, I didn't look in detail.

David



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Micro-optimizations to avoid some strlen calls.
Next
From: "David G. Johnston"
Date:
Subject: Re: Micro-optimizations to avoid some strlen calls.