Re: Performant queries on table with many boolean columns - Mailing list pgsql-performance

From Rick Otten
Subject Re: Performant queries on table with many boolean columns
Date
Msg-id CAMAYy4Krf1b3Lgz42-nAKYCSAfErhJospJp87yG5_HqkZCVO8A@mail.gmail.com
Whole thread Raw
In response to Re: Performant queries on table with many boolean columns  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-performance
Would a bit string column work? -- http://www.postgresql.org/docs/9.5/static/datatype-bit.html 

You might need to use a lot of bitwise OR statements in the query though if you are looking at very sparse sets of specific values...

Something like the get_bit() function might allow you to select a specific bit, but then you might want a bunch of functional indexes on the column for various get_bit() combinations.

Maybe you can group commonly queried sets of columns into bit strings.  (rather than having one bit string column for all 100 booleans).



On Wed, Apr 20, 2016 at 2:54 PM, Teodor Sigaev <teodor@sigaev.ru> wrote:

The obvious thing seems to make a table with ~100 columns, with 1 column
for each boolean property. Though, what type of indexing strategy would
one use on that table? Doesn't make sense to do BTREE. Is there a better
way to structure it?

looks like a deal for contrib/bloom index in upcoming 9.6 release


--
Teodor Sigaev                      E-mail: teodor@sigaev.ru
                                      WWW: http://www.sigaev.ru/


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

pgsql-performance by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: Performant queries on table with many boolean columns
Next
From: "David G. Johnston"
Date:
Subject: Re: Performant queries on table with many boolean columns