Re: CONNECT BY PRIOR - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: CONNECT BY PRIOR
Date
Msg-id 20051115151026.GI7519@svana.org
Whole thread Raw
In response to CONNECT BY PRIOR  (Yann Michel <yann-postgresql@spline.de>)
List 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@svana.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.

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Fixes for 8.1 run of pgindent
Next
From: Bruce Momjian
Date:
Subject: Re: Fixes for 8.1 run of pgindent