On 09/23/2014 05:17 AM, John R Pierce wrote:
>>
>
> this still won't address the issue that the postgresql server itself
> ALSO marshals the entire result set into ITS memory before sending it to
> the client. Really, using cursors for large result-sets is the correct
> way to go.
Er, it what?
It does no such thing.
For some queries it must prepare the entire result before it can send it
- e.g. if there's a top-level sort node that can't be satisfied by an
index-scan of the table in the desired sort order. It'll marshal such
results to disk if they don't fit within working memory, though. (Look
into the tuplestore code for details).
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services