Re: DAGs and recursive queries

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: DAGs and recursive queries
Дата
Msg-id 87abr77m1y.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: DAGs and recursive queries  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: DAGs and recursive queries  (Jeff Davis <pgsql@j-davis.com>)
Re: DAGs and recursive queries  ("paul.dorman" <paul.dorman@gmail.com>)
Список pgsql-general
"Jeff Davis" <pgsql@j-davis.com> writes:

> On Wed, 2007-09-26 at 16:54 +0100, Gregory Stark wrote:
>
>> You could check out the tablefunc contrib which includes a function called
>> connectby() which implements a kind of recursive query.
>>
>> Alternatively you might look at the ltree contrib module but that doesn't work
>> the way you describe. It denormalizes the data for very fast but less flexible
>
> Ltree seems like it might be a good option for him. What doesn't it do
> that he needs?
...
> Also, how exactly is the database denormalized by using ltree?

It keeps the same information in more than one place. Consider:

1
1.1
1.1.1

Note that all three records contain the root's id of "1". If you want to
reparent 1.1 to be 2.1 you have to know that all its children also need to be
reparented as well.

That's what he said he wanted to be able to do. In general if you have a
relatively static hierarchy something like ltree works very well but if you
have a very dynamic hierarchy where nodes move around freely it's not a very
good fit.


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

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

Предыдущее
От: Ottavio Campana
Дата:
Сообщение: question about pg_dump -a
Следующее
От: "Jan Theodore Galkowski"
Дата:
Сообщение: usage of indexes for inner joins