OT - Query for bit pattern

From: Paul Tomblin <ptomblin(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: OT - Query for bit pattern
Date: 2008-03-28 01:59:27
Message-ID: 47EC50FF.6000407@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

If I have a bunch of data where one column in the table is a bitmap, is there
an efficient way to do a query for all the records whose bitmap's first N bits
matches a particular pattern? Naively, I would store it as an int and do
whatever the sql equivalent of '(hhcode & 0b11110000...) = 0b010100000...)'.
But that is probably horribly inefficient. Is there a better way?

--
Paul Tomblin <ptomblin(at)xcski(dot)com> http://blog.xcski.com/
Revenge is an integral part of forgiving and forgetting.
-- The BOFH

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2008-03-28 02:11:04 Re: OT - Query for bit pattern
Previous Message Oliver Jowett 2008-03-27 10:23:40 Re: performance issue