Re: where does postgres keep the query result until it is returned?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: where does postgres keep the query result until it is returned?
Date: 2010-09-17 14:13:40
Message-ID: 10246.1284732820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2010-09-17 14:51:46 Re: where does postgres keep the query result until it is returned?
Previous Message Tom Lane 2010-09-17 14:05:16 Re: What's wrong with this query?