Luiz Angelo Daros de Luca wrote:
>
> I have a directed graph, or better, a tree in postgresql 8.3. One
> table are the nodes and another one are the connections. Given any
> node, I need to get all nodes down to it(to the leafs) that have
> relation with anotherTable. Also, this connection change on time, so I
> have a connectionDate and a disconnectionDate for each connection
> (which might be null to represent open interval). This way, I wrote a
> pgsql function (I rename the tables and columns to generic names).
> These are the tables and the function:
>
Hello Luiz,
If you could upgrade to 8.4, you could use WITH RECURSIVE - my
experience is that it is several orders of magnitude faster than
recursive functions.
http://developer.postgresql.org/pgdocs/postgres/queries-with.html
regards,
Yeb Havinga