Re: Bitmasks

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Ivan Voras <ivoras(at)fer(dot)hr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Bitmasks
Date: 2005-12-11 06:12:08
Message-ID: 87oe3of9hj.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Ivan Voras <ivoras(at)fer(dot)hr> writes:

> select * from tt where (flags & 16) != 0;
>
> I suspected radix trees could be used for this but it seems it doesn't work
> that way.

You would need a gist index method to make this work. I actually worked on one
for a while and had it working. But it wasn't really finished. If there's
interest I could finish it up and put it up somewhere like pgfoundry.

> If not, is there a way of quickly filtering by such "elements of a set" that
> doesn't involve creating 32 boolean fields (which would also need to be pretty
> uselessly indexed separately)?

You could create 32 partial indexes on some other column which wouldn't really
take much more space than a single index on that other column. But that won't
let you combine them effectively as a gist index would.

--
greg

In response to

  • Bitmasks at 2005-12-10 17:12:58 from Ivan Voras

Browse pgsql-performance by date

  From Date Subject
Next Message Carlos Benkendorf 2005-12-11 11:53:36 How much expensive are row level statistics?
Previous Message Manfred Koizar 2005-12-10 17:14:00 Re: Queries taking ages in PG 8.1, have been much faster in PG<=8.0