pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yeb Havinga <yebhavinga@gmail.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Immutable table functions
Date: Fri, 12 Feb 2010 14:31:22 +0100
Message-ID: <4B75582A.9090100@gmail.com> (raw)
In-Reply-To: <8b96e3d21002120454q77b1d72eq38a91b7f486e8f29@mail.gmail.com>
References: <8b96e3d21002120454q77b1d72eq38a91b7f486e8f29@mail.gmail.com>

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





view thread (2+ messages)

Message-ID: <4B75582A.9090100@gmail.com>
Permalink:  ../4B75582A.9090100@gmail.com/
Also on:    postgresql.org/message-id/4B75582A.9090100@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: yebhavinga@gmail.com, luizluca@gmail.com
  Subject: Re: Immutable table functions
  In-Reply-To: <4B75582A.9090100@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox