Re: Disk buffering of resultsets - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: Disk buffering of resultsets
Date
Msg-id 543007D4.6070109@2ndquadrant.com
Whole thread Raw
In response to Re: Disk buffering of resultsets  ("Lussier, Denis" <denisl@openscg.com>)
List pgsql-jdbc
On 09/23/2014 09:55 AM, Lussier, Denis wrote:
> Wow...  really glad Tom chimed in on this.    I've been promoting/using
> PG as an enterprise-class database for over a decade and I was
> struggling with the "fact" that the server doesn't iterate thru a cursor
> without bringing it all into memory.

Well, that assertion would've failed the common-sense sanity test anyway.

You can `SELECT * FROM my_100GB_table` on a machine with 1GB of RAM.
Clearly this is impossible if Pg must marshal all the results into RAM
first.

I think John's misapprehension probably stemmed from the fact that libpq
and many other clients *default* to fetching the whole result from the
server into RAM before reporting success to the caller. This makes it
*seem* like the server must marshal the whole result in memory, but it's
the client doing that, not the server.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Disk buffering of resultsets
Next
From: Craig Ringer
Date:
Subject: Re: Disk buffering of resultsets