Re: Recursive calls to functions that return sets

Поиск
Список
Период
Сортировка
От Thomas Hallgren
Тема Re: Recursive calls to functions that return sets
Дата
Msg-id 442188F7.8080503@tada.se
обсуждение исходный текст
Ответ на Re: Recursive calls to functions that return sets  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: Recursive calls to functions that return sets  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Recursive calls to functions that return sets  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Recursive calls to functions that return sets  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Recursive calls works in PL/Java. No problem there. But the larger the 
set, the more memory it consumes. Do I read your answers correctly if I 
conclude this is a known limitation when SPI is used? I.e. there's no 
way to stream one row at a time without ever building the full set?

Regards,
Thomas Hallgren


Andrew Dunstan wrote:
> Tom Lane wrote:
>
>>
>> plpgsql and similar languages will return a tuplestore anyway, so it has
>> to handle that case, and it was convenient to make all the cases look
>> alike for starters.  Nobody's yet gone back to improve it for the case
>> of languages that return a tuple per call.
>>
>>  
>>
>
>
>
> This would be hard to do in the plperl case, at least, and I would be 
> surprised if it weren't in most others too. So what plperl does is to 
> fetch the whole set on the first call and then fudges all the other 
> calls to get the next element from the result set. We save out the 
> intermediate tuple store on each call and restore it afterwards, so I 
> think recursion shouldn't be a difficulty.
>
> cheers
>
> andrew



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

Предыдущее
От: "Adrian Maier"
Дата:
Сообщение: Re: How to put back??
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Recursive calls to functions that return sets