From: | Richard Ollier <r(dot)ollier(at)tequila(dot)co(dot)jp> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Table design - unknown number of column |
Date: | 2006-11-09 08:34:31 |
Message-ID: | 4552E817.9050801@tequila.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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.
So I have 2 choices :
- Use a unique table and redesign this table and my application each
time I need to add a flag
- Split this table in 2 tables : a table containing the Not null data
and a table containing 3 columns (id, flag_name, flag_value). But in
this case how can I do a select where (flag_a=1 and flag_c=0 and
flag_k=1...) ? I would like to have 200 or more joins on the main table.
What would be the cleanest and most recommended solution ?
Thanks a lot for your help
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2006-11-09 09:06:33 | Re: planer picks a bad plan (seq-scan instead of index) |
Previous Message | Thomas H. | 2006-11-09 07:53:50 | Re: planer picks a bad plan (seq-scan instead of index) |