From: | Richard Ollier <r(dot)ollier(at)tequila(dot)co(dot)jp> |
---|---|
To: | Alban Hertroys <alban(at)magproductions(dot)nl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Table design - unknown number of column |
Date: | 2006-11-09 12:45:50 |
Message-ID: | 455322FE.6060506@tequila.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alban Hertroys wrote:
> Richard Ollier wrote:
>> Hello,
>>
>> For a project I have a table containing products and flags.
>> The columns of this table are of 2 kinds :
>> - Not null data (id, column1, column2)
>> - Flags (100 different flags set to 1 or 0)
>>
>> Over the time the number of flag will increase from 100 to 200 or more.
>
> Having 200 flags as 200 fields... Writing queries on that is going to
> be painful.
>
> I would probably look at bitwise operations, although 200 bits is
> quite a bit larger than a bigint. Maybe an array of ints would work...
>
> I don't suppose you expect 2^200 different combinations, maybe some of
> the flags can be grouped together?
Thanks for your time !
Even if I know it won't happen, there is 2^200 different combinations
possible as products are very different one from each others...
In the case I use an array of int, is the search fast and efficient ? I
actually never had to use an array in postgres till now..
From | Date | Subject | |
---|---|---|---|
Next Message | Sean Davis | 2006-11-09 13:13:11 | Re: Table design - unknown number of column |
Previous Message | Thomas H. | 2006-11-09 12:41:58 | Re: planer picks a bad plan (seq-scan instead of index) |