X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 22C48564DA for ; Wed, 9 Mar 2005 13:24:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11533-06 for ; Wed, 9 Mar 2005 13:23:55 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 53CA4564B4 for ; Wed, 9 Mar 2005 13:23:54 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1D91A9-0000GM-00; Thu, 10 Mar 2005 02:23:45 +1300 Message-ID: <422EF8DE.7040405@opencloud.com> Date: Thu, 10 Mar 2005 02:23:42 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Antony Paul Cc: Silvio Bierman , PostgreSQL JDBC Subject: Re: FW: PreparedStatement#setString on non-string parameters References: <2989532e05030819582e7c8d0a@mail.gmail.com> <2989532e050309011430062873@mail.gmail.com> In-Reply-To: <2989532e050309011430062873@mail.gmail.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/83 X-Sequence-Number: 12475 Antony Paul wrote: > The performance difference I noticed when it is scanning a table of > 150k records with a long query containing a lot of or conditions. The > difference is around 10-12 seconds. So I think it is not the time > taken to prepare the statement. I wasnt interested in further > investigation as we dropped the plan of upgrading still 8.x becomes > 9-12 months old. There are some performance implications of pushing parameter management to the server side: under 7.4.x, a prepared statement does not gain the benefit of knowing the concrete parameter values used in a particular query execution, which can affect the plan chosen (if a concrete value for a parameter isn't known, the index selectivity estimates may not be as good). In theory this should not be an issue if you set prepareThreshold=0 (either globally on the connection, or via setPrepareTheshold on the statement in question) to prevent reuse of server statements, and use an 8.0.x server. 8.0 defers the planning of unnamed (not reused) statements until actual parameter values are available, which may improve the plan chosen for that particular execution. If it's not that, I'd need a testcase to be able to investigate this further. -O