using new bitmap scans to index bit columns?

From: TJ O'Donnell <tjo(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: using new bitmap scans to index bit columns?
Date: 2005-11-09 18:18:35
Message-ID: 43723D7B.8070906@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I like the new bitmap scans and I'm wondering if there is any way
I can utilize them for my bitmask column, defined as bit(1024).
I use this column as a sort of fingerprint to quickly scan my tables.
But it is a scan, not an index. I have not figured out a way to
index the bitmask column. Is there some way it can be used as
an index now that there are bitmap scans in 8.1?

Currently I do this:
Select * from mytable where contains(bitmask, fingerprint(user_data))
and matches(datacolumn, user_data);

user_data is a string, like a regexp but with different semantics for chemical data.
bitmask is precomputed/stored as bit(1024) = fingerprint(datacolumn)
contains(a,b) returns bool as 'select b=(a&b);'

This works well because matches() is an expensive functions.
But it would work better if bitmask could be indexed, no?

TJ O'Donnell

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mikael Carneholm 2005-11-09 18:38:53 Hanging creating of function
Previous Message Matthew T. O'Connor 2005-11-09 18:12:31 Re: libpq version in rpm packages