I'm currently writing a plpgsql function that will select from a table and produce a substantial amount of data.
I was originally going to return an array, but I found a resource that explains the "RETURN NEXT operation - Very handy for callers.
However, I read this blurb which is concerning:
Note: The current implementation of RETURN NEXT and RETURN QUERY stores the entire result set before returning from the function, as discussed above. That means that if a PL/pgSQL function produces a very large result set, performance might be poor:
Is there a Postgres feature that would allow my function to stream the results back to the caller as they're produced? This might be a limitation of Postgres' architecture in general, but I want to make sure I'm not overlooking something!