Re: [HACKERS] WITH RECURSIVE patch V0.1

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Tatsuo Ishii <ishii(at)postgresql(dot)org>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] WITH RECURSIVE patch V0.1
Date: 2008-05-19 09:15:02
Message-ID: 48314516.7050007@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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. 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.
>
>
>>> Well, psql might wait and wait but it's actually receiving rows. A cleverer
>>> client should be able to deal with infinite streams of records.
>>>
>> I think it's the other way around. The server should not emit infinite
>> number of records.
>>
>
> The server won't, the universe will end first.

The universe is alive and well, thank you. :-)
But the server won't emit infinite number of records, you are right.
Given the implementation uses a tuplestore and not producing the
tupleslots on the fly, it will go OOM first not the psql client,
I watched them in 'top'. It just takes a bit of time.

> This is a nice example
> of the halting problem:
>
> http://en.wikipedia.org/wiki/Halting_problem
>
> Which was proved unsolvable a long time ago.
>

Hmpf, yes, I forgot too much about Turing-machines since university. :-(

> Have a nice day,
>

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2008-05-19 09:42:24 triggers on prepare, commit, rollback... ?
Previous Message Zoltan Boszormenyi 2008-05-19 09:10:30 Re: WITH RECURSIVE patch V0.1

Browse pgsql-patches by date

  From Date Subject
Next Message Zoltan Boszormenyi 2008-05-19 09:56:17 Re: [HACKERS] WITH RECURSIVE patch V0.1
Previous Message Zoltan Boszormenyi 2008-05-19 09:10:30 Re: WITH RECURSIVE patch V0.1