On Fri, Sep 17, 2010 at 03:00:36PM +0200, Willy-Bas Loos wrote: > Where does postgres keep the query result until it is returned? > In the shared_buffers? > Or in extra memory that was not previously allocated, or something else? 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. The client side however isn't as intelligent, libpq will, by default, try and read all records into memory and will crash if the results are too large. There are various ways of dealing with this, but haven't tried myself. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general