X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 073379FA65C for ; Wed, 21 Jun 2006 13:46:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 17639-06 for ; Wed, 21 Jun 2006 13:46:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 756A29FB1BC for ; Wed, 21 Jun 2006 13:46:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5LGkYws011363; Wed, 21 Jun 2006 12:46:34 -0400 (EDT) To: "A.M." cc: pgsql-jdbc@postgresql.org Subject: Re: Limit vs setMaxRows issue In-reply-to: <34158.216.41.12.254.1150906222.squirrel@webmail.webopticon.org> References: <44990D57.9070506@sebster.com> <34158.216.41.12.254.1150906222.squirrel@webmail.webopticon.org> Comments: In-reply-to "A.M." message dated "Wed, 21 Jun 2006 12:10:22 -0400" Date: Wed, 21 Jun 2006 12:46:34 -0400 Message-ID: <11362.1150908394@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/74 X-Sequence-Number: 15354 "A.M." writes: > On Wed, June 21, 2006 12:00 pm, Kris Jurka wrote: >> If you're suggesting that we extended the >> frontend/backend protocol to include this extra information than that's >> definitely a feature request, not a bug report. > The backend protocol already supports maximum row limit if you use the > extended protocol. No, it would take a protocol change to add such a thing out-of-line (that is, not as a LIMIT clause in the query text). The reason is that the planning is done at PARSE time, or at the latest BIND time. The row limit field in the EXECUTE message comes far too late to affect the query plan. EXECUTE's row limit was not meant as anything except a way to fetch a query result in segments, avoiding the grab-it-all-at-once, run-out-of-memory syndrome. It is definitely *not* meant to imply that the client doesn't intend to fetch the whole query result eventually. I don't have a lot of sympathy for the OP's position that he shouldn't have to use a LIMIT clause for this ... regards, tom lane