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/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers