Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
> On Fri, Sep 17, 2010 at 02:14:57PM +0100, Sam Mason wrote:
>> Postgres, the server software, will spill large results (and any
>> intermediate working sets) to disk automatically as needed. I believe
>> any memory allocated for this task will be up to work_mem in size.
> That wasn't very clear was it; when I said "this task" I meant the task
> of accumulating results before things spill.
If the question was about the final query result sent to the client:
we don't spill that to disk, nor "hold" it anywhere. The backend
sends it to the client on-the-fly as each row is generated. It's
the client's responsibility to cope if the result set is huge.
(As you noted, libpq is none too bright about that.)
regards, tom lane