Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B727A1337C90 for ; Fri, 8 Oct 2010 06:13:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 58833-02-6 for ; Fri, 8 Oct 2010 09:13:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [174.34.188.2]) by mail.postgresql.org (Postfix) with ESMTP id 0511A1337C3E for ; Fri, 8 Oct 2010 06:12:44 -0300 (ADT) Received: from 188.147.3.2.nat.umts.dynamic.eranet.pl ([188.147.3.2]:63796 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1P490M-0003tv-AE; Fri, 08 Oct 2010 04:12:43 -0500 From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: The logic behind the prepared statement in PostgreSQL Date: Fri, 8 Oct 2010 11:12:37 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34-gentoo-r6; KDE/4.4.5; x86_64; ; ) Cc: louis , Oliver Jowett References: <1286365302.13691.35.camel@london> <4CACE716.5010600@opencloud.com> <1286430904.7465.4.camel@london> In-Reply-To: <1286430904.7465.4.camel@london> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201010081112.37192.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/62 X-Sequence-Number: 21030 Hi, > I think it's because postgresql JDBC Driver has a default limit for the m= ax > number of preparedStatement, which is 4. Can anyone tell me where to > adjuest this parameter? This parameter 4 is associated with prepare threshold. It says how many tim= es=20 the given prepared statement (as Java object) will be executed before it wi= ll=20 be compiled into true, server side prepared statement. In many applications developers uses PreparedStatement class just to wrap=20 parameters, so compiling such statement in server side statement adds unnee= ded=20 overhead. After you execute such PS few times then it's compiled, and in lo= gs=20 you will see EXECUTE S_1 or S_1/C_1. PG JDBC driver doesn't have built in support for caching statements in any= =20 way, so two statements with same SQL will be mapped to different statements= in=20 database, even if that are called in scope of same connection. If you would like to cache statements, currently most servers support this,= by=20 wrapping original database objects. Kind ragards, Rados=C5=82aw Smogura http://www.softperience.eu