Re: bitmask index

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: bitmask index
Date: 2011-06-22 21:42:25
Message-ID: 4E0261C1.8000807@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 06/22/2011 05:27 PM, Marcus Engene wrote:
> I have some tables with bitmask integers. Set bits are the interesting
> ones. Usually they are sparse.

If it's sparse, create a partial index that just includes rows where the
bit is set:
http://www.postgresql.org/docs/current/static/indexes-partial.html

You need to be careful the query uses the exact syntax as the one that
created the index for it to be used. But if you do that, it should be
able to pull the rows that match out quickly.

--
Greg Smith 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Harry Mantheakis 2011-06-23 15:05:45 Long Running Update
Previous Message Greg Smith 2011-06-22 21:35:39 Re: seq scan in the case of max() on the primary key column