pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ivan Voras <ivoras@fer.hr>
To: pgsql-performance@postgresql.org
Subject: Bitmasks
Date: Sat, 10 Dec 2005 18:12:58 +0100
Message-ID: <439B0C9A.6010109@fer.hr> (raw)

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?



view thread (2+ messages)  latest in thread

Message-ID: <439B0C9A.6010109@fer.hr>
Permalink:  ../439B0C9A.6010109@fer.hr/
Also on:    postgresql.org/message-id/439B0C9A.6010109@fer.hr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: ivoras@fer.hr
  Subject: Re: Bitmasks
  In-Reply-To: <439B0C9A.6010109@fer.hr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox