Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 95267633369 for ; Thu, 14 May 2009 15:58:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 60007-10 for ; Thu, 14 May 2009 15:58:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id DD1F963231E for ; Thu, 14 May 2009 15:58:27 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 79E1EA99C; Thu, 14 May 2009 14:58:26 -0400 (EDT) Date: Thu, 14 May 2009 14:58:26 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Oliver Jowett cc: Thomas Finneid , pgsql-jdbc@postgresql.org Subject: Re: pooled prepared statements In-Reply-To: <4A0A17D8.5020808@opencloud.com> Message-ID: References: <4A0978A3.6030900@fcon.no> <4A0A17D8.5020808@opencloud.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL=0.008 X-Spam-Level: X-Archive-Number: 200905/84 X-Sequence-Number: 19634 On Wed, 13 May 2009, Oliver Jowett wrote: > Thomas Finneid wrote: > >> When a PreparedStatment is created by a pooled connection, as far as I >> understand if, that creation happens on the server side, and a >> reference, of sorts, is returned to the client jdbc. > > More or less, yes. (Assuming you're reusing the statement, not just > using it once and discarding it). > It really depends on the driver and connection pool that you are using. The idea of having a PreparedStatement cache (that doesn't require retaining a reference to the PreparedStatement) has been suggested for the driver, but rejected. A connection pool which proxies the real connection can provide this functionality instead. The pooler provided with the postgresql driver does not do this, but for example DBCP can. So as long as your pool or driver are reasonably smart, don't overthink this and let them handle it for you. Kris Jurka