pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Elias Ghanem <e.ghanem@acteos.com>
To: pgsql-performance@postgresql.org
Subject: Queries with conditions using bitand operator
Date: Tue, 13 Jul 2010 14:48:09 +0300
Message-ID: <4C3C5279.5090108@acteos.com> (raw)

Hi,
I have table "ARTICLE" containing a String a field "STATUS" that 
represents a number in binary format (for ex: 10011101).
My application issues queries with where conditions that uses BITAND 
operator on this field (for ex: select * from article where status & 4 = 4).
Thus i'm facing performance problemes with these select queries: the 
queries are too slow.
Since i'm using the BITAND operator in my conditions, creating an index 
on the status filed is useless
  and since the second operator variable (status & 4 = 4; status & 8 = 
8; status & 16 = 16...) a functional index is also usless (because a 
functional index require the use of a function that accept only table 
column as input parameter: constants are not accepted).
So is there a way to enhance the performance of these queries?
Thanks,
Elias



view thread (4+ messages)  latest in thread

Message-ID: <4C3C5279.5090108@acteos.com>
Permalink:  ../4C3C5279.5090108@acteos.com/
Also on:    postgresql.org/message-id/4C3C5279.5090108@acteos.com

 · 

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: e.ghanem@acteos.com
  Subject: Re: Queries with conditions using bitand operator
  In-Reply-To: <4C3C5279.5090108@acteos.com>

* 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