Re: Best way to scan on-disk bitmaps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Victor Y(dot) Yegorov" <viy(at)mits(dot)lv>
Cc: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Best way to scan on-disk bitmaps
Date: 2005-05-12 21:40:06
Message-ID: 12737.1115934006@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Victor Y. Yegorov" <viy(at)mits(dot)lv> writes:
> If I have on-disk bitmap
> ON (a, b, c)
> will the planner pick an index scan for
> WHERE a = 42 AND b = 'foo'
> (i.e. only part of the index attributes are involved)? Any modifications
> needed to achieve this functionality?

Hmm. That particular case will work, but the planner believes that only
consecutive columns in the index are usable --- that is, if you have
quals for a and c but not for b, it will think that the condition for c
isn't usable with the index. This is true for btree and gist indexes,
so I suppose we'd need to introduce a pg_am column that tells what to
do.

[ thinks some more ... ]

Plan B would be to remove that restriction and teach btree and gist to
cope. While a btree couldn't use a nonconsecutive restriction as part
of its where-to-scan logic, I don't see any good reason why it couldn't
still perform the test before returning the TID, thus possibly saving a
trip to the heap. Offhand it seems this should be true of gist as well,
but I don't know that code well enough to be sure.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Jowett 2005-05-12 21:43:55 Re: SQL_ASCII vs. 7-bit ASCII encodings
Previous Message Victor Y. Yegorov 2005-05-12 21:27:01 Re: Best way to scan on-disk bitmaps