Bitmasks

From: Ivan Voras <ivoras(at)fer(dot)hr>
To: pgsql-performance(at)postgresql(dot)org
Subject: Bitmasks
Date: 2005-12-10 17:12:58
Message-ID: 439B0C9A.6010109@fer.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Can indexes be used for bit-filtering queries? For example:

create table tt (
flags integer not null default 0,
str varchar
);

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.

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)?

Would strings and regular expressions work?

Responses

Browse pgsql-performance by date

  From Date Subject
Next 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
Previous Message Tom Lane 2005-12-10 16:53:50 Re: Clustered tables and seqscan disabled