Re: CONNECT BY PRIOR

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Hannu Krosing <hannu(at)skype(dot)net>
Cc: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Yann Michel <yann-postgresql(at)spline(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CONNECT BY PRIOR
Date: 2005-11-15 15:10:28
Message-ID: 20051115151026.GI7519@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 15, 2005 at 04:13:47PM +0200, Hannu Krosing wrote:
> On T, 2005-11-15 at 09:53 +0100, Martijn van Oosterhout wrote:
> > On Tue, Nov 15, 2005 at 01:38:31AM -0500, Jonah H. Harris wrote:
> > > Hey Simon,
> > > I'm doing some research into recursive query planning in terms of theory
> > > as-well-as actual implementation in other RDBMS. Let me get back to you when
> > > I have some more definitive info.
> >
> > My first reaction would be to have a sort of Repeat node, with two
> > subnodes, the Tail and the Loop. The procedure would be to extract a
> > tuple from the Tail (optionally returning it). Then put that tuple
> > as the input to the Loop and start pulling tuples out of that.
>
> Will this work for both DEPTH FIRST and BREADTH FIRST recursion ?

This would be BREADTH FIRST recursion. If you want depth first you just
need to feed the tuples in reverse order (LIFO rather than FIFO).

The only thing to keep between runs is sets of tuples, and we already
know how to do that (Sort for example).

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-11-15 15:11:41 Re: Fixes for 8.1 run of pgindent
Previous Message Andreas Joseph Krogh 2005-11-15 15:01:24 Re: Running PostGre on DVD