Re: bitmask index - Mailing list pgsql-performance

From Greg Smith
Subject Re: bitmask index
Date
Msg-id 4E0261C1.8000807@2ndQuadrant.com
Whole thread Raw
In response to bitmask index  (Marcus Engene <mengpg2@engene.se>)
Responses Re: bitmask index  (Robert Klemme <shortcutter@googlemail.com>)
Re: bitmask index  (Marcus Engene <mengpg2@engene.se>)
List 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@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


pgsql-performance by date:

Previous
From: Greg Smith
Date:
Subject: Re: seq scan in the case of max() on the primary key column
Next
From: Robert Klemme
Date:
Subject: Re: bitmask index