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 7B1E39FB265 for ; Mon, 10 Jul 2006 05:51:41 -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 84845-09 for ; Mon, 10 Jul 2006 05:51:37 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 0221B9FB256 for ; Mon, 10 Jul 2006 05:51:35 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FzrUG-0005XX-5t for pgsql-jdbc@postgresql.org; Mon, 10 Jul 2006 10:51:28 +0200 Received: from 83.145.96.118 ([83.145.96.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jul 2006 10:51:28 +0200 Received: from Marc.Herbert by 83.145.96.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 10 Jul 2006 10:51:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Marc Herbert Subject: Re: Limit vs setMaxRows issue Date: Mon, 10 Jul 2006 10:51:21 +0200 Lines: 16 Message-ID: References: <44990D57.9070506@sebster.com> <34158.216.41.12.254.1150906222.squirrel@webmail.webopticon.org> <11362.1150908394@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 83.145.96.118 User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:EF2DPGz7bBwbfx+DJjj2doN7gKc= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/21 X-Sequence-Number: 15447 Tom Lane writes: > 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. If planning is done at time of creation of the PreparedStatement object (reminder: the example given above has no parameters), then the setMaxRows() call will come too late whatever is the protocol change. I mean: no protocol change can go back in time and "optimize" by not doing useless work already done. Thanks in advance for pointing out my mistake(s) here.