Re: WITH RECUSIVE patches 0723

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WITH RECUSIVE patches 0723
Дата
Msg-id 22969.1217263464@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WITH RECUSIVE patches 0723  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> This isn't going to be a particularly simple fix :-(.  The basic
>> implementation clearly ought to be to dump the result of the subquery
>> into a tuplestore and then have the upper level read out from that.
>> However, we don't have any infrastructure for having multiple
>> upper-level RTEs reference the same tuplestore.

> Uhm, indeed, isn't that the whole point of the work needed to make recursive
> queries work?

No, I don't think so.  The present patch (so far as I've gathered what
it can do, in the absence of any documentation) knows how to feed back
tuples collected at an upper level to a scan node at a lower level,
which is needed to implement recursion.  However, if you do
WITH RECURSIVE foo AS (...) SELECT ... FROM foo a, foo b WHERE

then you will still get two independent evaluations of duplicate
querytrees.  Which is at least a performance bug, and if there are
any volatile functions inside foo I claim it's a spec violation too.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: WITH RECUSIVE patches 0723
Следующее
От: "Stephen R. van den Berg"
Дата:
Сообщение: Re: Protocol 3, Execute, maxrows to return, impact?