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 A5A579FB26C for ; Tue, 11 Jul 2006 07:01:31 -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 18593-06 for ; Tue, 11 Jul 2006 07:01:28 -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 461049FB259 for ; Tue, 11 Jul 2006 07:01:28 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G0F3N-0007se-BD for pgsql-jdbc@postgresql.org; Tue, 11 Jul 2006 12:01:17 +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 ; Tue, 11 Jul 2006 12:01:17 +0200 Received: from Marc.Herbert by 83.145.96.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Jul 2006 12:01:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Marc Herbert Subject: Re: Limit vs setMaxRows issue Date: Tue, 11 Jul 2006 12:00:56 +0200 Lines: 37 Message-ID: References: <44990D57.9070506@sebster.com> <4499CDB3.7040007@opencloud.com> <44B3461F.1060408@opencloud.com> 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:914TFGagARHNFll1fWlU9QwGyOw= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/32 X-Sequence-Number: 15458 >> My reading of the JDBC javadoc and my excessive "pickiness" do not >> agree with the word "hint" >> /** >> * Sets the limit for the maximum number of rows that any >> * ResultSet object can contain to the given number. >> * If the limit is exceeded, the excess >> * rows are silently dropped. >> OK nothing ever tells you that the server has to behave optimally and >> never compute anything useless. However in this case you know _for >> sure_ that additional rows will be useless. > > I would assume that if the intent of the spec was "put LIMIT on the > query", they would say that. I think they would never say that, because they are quite careful not to ever try to enforce any kind of implementation/performance detail. They just care about the interface and the external results, any timing consideration always excluded. So the way they seem to do it, is just to open a 8 lanes wide road to performance in front of you ("if you compute that, it WILL be useless and dropped at some point. Now compute what you want."). My poor english skills would not have called this a "hint". I guess this is just a minor misunderstanding. Of course I'm assuming here that computing those excess rows has no side-effect. Hopefully this is always the case?! > As it stands all it does from an API point of view is change the > behaviour of the ResultSet. Whether that does anything for efficiency > is an implementation decision. The driver certainly behaves correctly > according to the API, which was my point. Agreed for sure.