Re: Planner question - "bit" data types

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Karl Denninger <karl(at)denninger(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Planner question - "bit" data types
Date: 2009-09-04 22:29:59
Message-ID: 4AA194E7.8010504@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2009-09-05 20:09:07 Re: Planner question - "bit" data types
Previous Message Kevin Grittner 2009-09-04 22:09:37 Re: Seeking performance advice and explanation for high I/O on 8.3