Re: plperl (7.5) - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: plperl (7.5)
Date
Msg-id 40F9BBC7.3000209@dunslane.net
Whole thread Raw
In response to plperl (7.5)  (elein <elein@varlena.com>)
List pgsql-hackers

elein wrote:

>The new plperl returns sets by having 
>the function return an array.
>
>This requires that the entire array be
>built before anything is returned.
>
>It seems to me that that does not scale
>very well.  The technique of RETURN NEXT;
>scales much better.
>  
>

Indeed.

>For example, you maybe selecting rows,
>doing a little formating and adding some
>information and returning the rows as you
>process them.  It the table you are selecting
>is very large, you still have to hold the
>results in memory to return them all at 
>once.
>
>Am I misunderstanding something or can
>someone explain the reasoning?
>  
>

The reasoning behind the current set of new features is simple - what 
has been provided is what we were able to get done before feature 
freeze. It is not by any means all that is intended by the plperlng 
project. The rest will have to wait for another release.

>In an ideal implementation both techniques
>would be possible since returning the array
>is kind of cool ;-)
>
>
>  
>

Quite so. I think we would have to provide a callback procedure to add a 
resultset member, and we could easily have it set a flag so that if it 
had been used in the function call we would use that method of 
accumulating resultset members, otherwise we would use the current 
all-at-once method.

But before we embark on any such exercise, we need to have a good 
discussion of future features and APIs. My intention was to start that 
discussion after we put the 7.5 stuff to bed. Please feel free to join 
the plperlng-devel mailing list.

cheers

andrew


pgsql-hackers by date:

Previous
From: Gaetano Mendola
Date:
Subject: NT and aborted transaction
Next
From: "Matthew T. O'Connor"
Date:
Subject: Vacuum Cost Documentation?