Re: Table-design for categories, suggestions needed

Поиск
Список
Период
Сортировка
От Richard Broersma
Тема Re: Table-design for categories, suggestions needed
Дата
Msg-id A835E918-24D8-4AE1-BA43-9B04C1EF3DAA@gmail.com
обсуждение исходный текст
Ответ на Re: Table-design for categories, suggestions needed  (Rikard Bosnjakovic <rikard.bosnjakovic@gmail.com>)
Список pgsql-novice
On Aug 5, 2010, at 3:50 PM, Rikard Bosnjakovic
>
> Perhaps a better example is an Ebay-listing. For a random page I have
> open right now I see at the top: "Listed in category: Mobile & Home
> Phones > Mobile Phone Accessories > Other Mobile Phone Accessories >
> Other Mobile Phone Accessories".
>
> This "chain" is what I'm trying to duplicate.


Okay, then what you are trying to model is a tree.

Postgresql has a special contrib module called Ltree that manages this nicely.

Other than this, there are three data models that you can choose from:

Adjacency list model Aka BOM model
Path enumeration model
Nested set model

The first model is probably the easiest to grasp.  And since pg 8.4 supports recursive queries this model becomes a
nicechoice.  

Sent from my iPod

В списке pgsql-novice по дате отправления:

Предыдущее
От: Leon Starr
Дата:
Сообщение: Best way to test/develop lots of nested functions?
Следующее
От: "Carel Combrink"
Дата:
Сообщение: Libpq in C Language Function