Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9714263333A for ; Mon, 12 Apr 2010 23:49:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 45911-10 for ; Tue, 13 Apr 2010 02:49:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id D7FFA633089 for ; Mon, 12 Apr 2010 23:49:30 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o3D2nUd02232; Mon, 12 Apr 2010 22:49:30 -0400 (EDT) From: Bruce Momjian Message-Id: <201004130249.o3D2nUd02232@momjian.us> Subject: Re: *** PROBABLY SPAM *** Does the psql executable support a "fetch many" approach when dumping large queries to stdout? In-Reply-To: To: Pierre C Date: Mon, 12 Apr 2010 22:49:29 -0400 (EDT) CC: "Beaver, John E" , "pgsql-performance@postgresql.org" X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.344 tagged_above=-10 required=5 tests=AWL=-0.834, BAYES_05=-0.5, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/161 X-Sequence-Number: 38411 Pierre C wrote: > > Does the psql executable have any ability to do a "fetch many", using a > > server-side named cursor, when returning results? It seems like it tries > > to retrieve the query entirely to local memory before printing to > > standard out. > > I think it grabs the whole result set to calculate the display column > widths. I think there is an option to tweak this but don't remember which, > have a look at the psql commands (\?), formatting section. See the FETCH_COUNT variable mentioned in the psql manual page. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com