Faster db architecture for a twisted table.

Поиск
Список
Период
Сортировка
От Rodrigo Madera
Тема Faster db architecture for a twisted table.
Дата
Msg-id 3cf983d0512031500r2a9da709r8eb362806e91f61@mail.gmail.com
обсуждение исходный текст
Ответы Re: Faster db architecture for a twisted table.  (Andreas Pflug <pgadmin@pse-consulting.de>)
Re: Faster db architecture for a twisted table.  (Klint Gore <kg@kgb.une.edu.au>)
Re: Faster db architecture for a twisted table.  (Mitchell Skinner <mitch@arctur.us>)
Список pgsql-performance
Imagine a table named Person with "first_name" and "age".

Now let's make it fancy and put a "mother" and "father" field that is
a reference to the own table (Person). And to get even fuzzier, let's
drop in some siblings:

CREATE TABLE person(
   id bigint PRIMARY KEY,
   first_name TEXT,
   age INT,
   mother bigint REFERENCES person,
   father biging REFERENCES person,
   siblings array of bigints  (don't remember the syntax, but you get the point)
);

Well, this is ok, but imagine a search for  "brothers of person id
34". We would have to search inside the record's 'siblings' array. Is
this a bad design? is this going to be slow?

What would be a better design to have these kind of relationships?
(where you need several references to rows inside the table we are).

Thanks for any help,
Rodrigo

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

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: Database restore speed
Следующее
От: Mitch Skinner
Дата:
Сообщение: Re: Database restore speed