Re: Planner question - "bit" data types - Mailing list pgsql-performance

From Josh Berkus
Subject Re: Planner question - "bit" data types
Date
Msg-id 4AA194E7.8010504@agliodbs.com
Whole thread Raw
In response to Planner question - "bit" data types  (Karl Denninger <karl@denninger.net>)
Responses Re: Planner question - "bit" data types
List pgsql-performance
Karl,

> For reference, I was having SEVERE performance problems with the
> following comparison in an SQL statement where "mask" was an integer:
>
> "select ... from .... where ...... and (permission & mask = permission)"

AFAIK, the only way to use an index on these queries is through
expression indexes.  That's why a lot of folks use INTARRAY instead; it
comes with a GIN index type.

It would probably be possible to create a new index type using GiST or
GIN which indexed bitstrings automatically, but I don't know that anyone
has done it yet.

Changing your integer to a bitstring will not, to my knowledge, improve
this.

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Seeking performance advice and explanation for high I/O on 8.3
Next
From: Merlin Moncure
Date:
Subject: Re: Planner question - "bit" data types