Re: Performant queries on table with many boolean columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxx
                                      WWW: http://www.sigaev.ru/


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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux