Queries with conditions using bitand operator

From: Elias Ghanem <e(dot)ghanem(at)acteos(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Queries with conditions using bitand operator
Date: 2010-07-13 11:48:09
Message-ID: 4C3C5279.5090108@acteos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dimitri Fontaine 2010-07-13 14:42:23 Re: Pooling in Core WAS: Need help in performance tuning.
Previous Message damien hostin 2010-07-13 08:51:47 Re: Slow query with planner row strange estimation