Processing Tables containing tree-like data

Поиск
Список
Период
Сортировка
От psql-novice@netzach.co.il
Тема Processing Tables containing tree-like data
Дата
Msg-id Pine.LNX.4.58.0705291945470.6674@perpetual.homelinux.org
обсуждение исходный текст
Ответы Re: Processing Tables containing tree-like data  (Richard Broersma Jr <rabroersma@yahoo.com>)
Re: Processing Tables containing tree-like data  (Michael Glaesemann <grzm@seespotcode.net>)
Re: Processing Tables containing tree-like data  ("Burak Seydioglu" <buraks78@gmail.com>)
Список pgsql-novice
Hi,

I have a table which looks like this:

id    info    parentid
0    <God>    0
1    Adam    0
2    Cain    1
3    Abel    1
4    Seth    1
5    Enosh    4
....



I am looking for a fast and efficient way of finding ALL the descendents
of any particular node, to unlimited depth.

Is there a standard database trick for doing this efficiently ? Writing
a recursive function would be extremely inefficient for repeated
queries.

Thanks,


Netzach

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

Предыдущее
От: Joshua
Дата:
Сообщение: Re: problems with SELECT query results
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Processing Tables containing tree-like data