| От | Sean Davis |
|---|---|
| Тема | Re: Table design - unknown number of column |
| Дата | |
| Msg-id | 200611090813.11651.sdavis2@mail.nih.gov обсуждение |
| Ответ на | Table design - unknown number of column (Richard Ollier <r.ollier@tequila.co.jp>) |
| Список | pgsql-general |
I think the typical way of attacking a problem would be a second and third table. The second table would look like: flat_type table flag_type_id flag_type (like the column name in your original table) flag_type_description (BONUS: you can describe each flag) product_flag table product_id (fk to your original table) flag_type_id (fk to the flag_type table) flag_value (0, 1, or whatever you want to store here) The advantages with this method are several: 1) No wasted storage for all those NULLs where a flag is not needed 2) Should be very fast to lookup by product_id to get all flags 3) You can expand to an arbitrary number of flags 4) Your schema remains normalized Sean
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера