Re: Best way to scan on-disk bitmaps

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Victor Y. Yegorov" <viy@mits.lv>
Cc: Postgres Hackers <pgsql-hackers@postgresql.org>
Date: 2005-05-12T20:10:15Z
Lists: pgsql-hackers
"Victor Y. Yegorov" <viy@mits.lv> writes:
> I have questions on how to implement on-disk bitmap scan.

I think your best plan might be

1. Be sure that all the indexable WHERE conditions are passed to the
   indexscan as indexquals.  This might be, say,
	WHERE a = 42 and b = 'foo'

2. Within the index AM, form the AND of the relevant bitmaps (here the
   ones for a = 42 and b = 'foo').

3. Within the index AM, pick up the TIDs for the remaining one-bits,
   and pass them back.

4. Let the existing machinery handle the OR-ing problem as well as
   actual fetching of the heap rows.

This can be done without any restructuring of the index AM API.

			regards, tom lane