pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndquadrant.com>
To: Lussier, Denis <denisl@openscg.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John R Pierce <pierce@hogranch.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Disk buffering of resultsets
Date: Sat, 04 Oct 2014 22:44:36 +0800
Message-ID: <543007D4.6070109@2ndquadrant.com> (raw)
In-Reply-To: <CAHKhnVXnxjr0gOqQV-JkQTWuu=6d-iYXY0V9jXVDgSBE==ZBwQ@mail.gmail.com>
References: <CAHKhnVUW9hu9ePD9zeVmvkeRjK8VaO9_jVDdqiNPf8=xBkaM1Q@mail.gmail.com>
	<541E7FC3.3000201@2ndquadrant.com>
	<3F6D0B4E-2FA9-42D0-8C2C-DC68E6D0D641@gmail.com>
	<54205F94.9010102@hogranch.com>
	<CAHKhnVX5qxNOCBFXwivt1Mwzdaru9hoG9wCviAKUj9Dcmnu=0w@mail.gmail.com>
	<542091F0.10706@hogranch.com>
	<1321.1411433175@sss.pgh.pa.us>
	<CAHKhnVXnxjr0gOqQV-JkQTWuu=6d-iYXY0V9jXVDgSBE==ZBwQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (37+ messages)  latest in thread

Message-ID: <543007D4.6070109@2ndquadrant.com>
Permalink:  ../543007D4.6070109@2ndquadrant.com/
Also on:    postgresql.org/message-id/543007D4.6070109@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@2ndquadrant.com, denisl@openscg.com, tgl@sss.pgh.pa.us, pierce@hogranch.com
  Subject: Re: Disk buffering of resultsets
  In-Reply-To: <543007D4.6070109@2ndquadrant.com>
  References: <CAHKhnVUW9hu9ePD9zeVmvkeRjK8VaO9_jVDdqiNPf8=xBkaM1Q@mail.gmail.com> <541E7FC3.3000201@2ndquadrant.com> <3F6D0B4E-2FA9-42D0-8C2C-DC68E6D0D641@gmail.com> <54205F94.9010102@hogranch.com> <CAHKhnVX5qxNOCBFXwivt1Mwzdaru9hoG9wCviAKUj9Dcmnu=0w@mail.gmail.com> <542091F0.10706@hogranch.com> <1321.1411433175@sss.pgh.pa.us> <CAHKhnVXnxjr0gOqQV-JkQTWuu=6d-iYXY0V9jXVDgSBE==ZBwQ@mail.gmail.com> <543007D4.6070109@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox