Re: WITH RECURSIVE patch V0.1 - Mailing list pgsql-hackers

From Zoltan Boszormenyi
Subject Re: WITH RECURSIVE patch V0.1
Date
Msg-id 48314EC1.5070504@cybertec.at
Whole thread Raw
In response to Re: WITH RECURSIVE patch V0.1  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: WITH RECURSIVE patch V0.1
List pgsql-hackers
Martijn van Oosterhout írta:
> On Mon, May 19, 2008 at 08:19:17AM +0200, Zoltan Boszormenyi wrote:
>
>>> The standard has a clause to specify depth-first order. However doing a
>>> depth-first traversal would necessitate quite a different looking plan and
>>> it's far less obvious (to me anyways) how to do it.
>>>
>> That would be even cooler to have it implemented as well.
>>
>
> From an implementation point of view, the only difference between
> breadth-first and depth-first is that your tuplestore needs to be LIFO
> instead of FIFO.

Are you sure? I think a LIFO tuplestore would simply return reversed
breadth-first order. Depth-first means for every new record descend into
another recursion first then continue with the next record on the right.

> However, just looking at the plan I don't know whether
> it could support that kind of usage. At the very least I don't think
> the standard tuplestore code can handle it.
>


--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: triggers on prepare, commit, rollback... ?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: WITH RECURSIVE patch V0.1