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 251D49FB2B4 for ; Tue, 11 Jul 2006 07:46:12 -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 23954-08 for ; Tue, 11 Jul 2006 07:46:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 4D8219FB27E for ; Tue, 11 Jul 2006 07:46:01 -0300 (ADT) Received: from 203-118-178-246.bliink.ihug.co.nz ([203.118.178.246] helo=[10.1.1.6]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1G0Fkc-0007DR-1b; Tue, 11 Jul 2006 22:45:58 +1200 Message-ID: <44B38164.1040606@opencloud.com> Date: Tue, 11 Jul 2006 22:45:56 +1200 From: Oliver Jowett User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Marc Herbert CC: pgsql-jdbc@postgresql.org Subject: Re: Limit vs setMaxRows issue References: <44990D57.9070506@sebster.com> <34158.216.41.12.254.1150906222.squirrel@webmail.webopticon.org> <11362.1150908394@sss.pgh.pa.us> <44B34751.7010704@opencloud.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/33 X-Sequence-Number: 15459 Marc Herbert wrote: > Oliver Jowett writes: >> the query is parsed and planned immediately before execution. > > Hum, interesting. Looks like "lazy prepared" statement, no > pre-compilation? If you delay parsing & planning then of course you > would not need to go back in time to add late > optimizations... I don't know what you mean by "lazy prepared" statements. We give the statement to the server for parsing and planning at the point when we know both the query and the parameter types -- which, because of the JDBC API design, means just before execution. We retain the parse/plan results on the server side when it looks like the statement will be reused (using a simple "how many times has this statement already been reused?" metric), otherwise we reparse/replan on each execution. > However, what about the following executions of the same and now > already prepared and planned statement? Now you would have to go back > in time to perform any .setMaxRows() optimization, right? It's no different to the case where you change the parameter types really. -O