Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6272A632FAF for ; Tue, 12 May 2009 23:02:16 -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 03063-09 for ; Tue, 12 May 2009 23:02:02 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.30]) by mail.postgresql.org (Postfix) with ESMTP id 89657633E0E for ; Tue, 12 May 2009 23:02:11 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so188904ywj.73 for ; Tue, 12 May 2009 19:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=SQy8VbCp4IRQRw0wMqFRZqkm680d7LtU+jBLs62HfoM=; b=Po0B19q8a4YtcVIIE1N3exTW62OkO2mskr20AK3DKfK45ErW+t7vuqXTufepivyd6s ffxQCot+ViSSQRIrsQFR/6bJulFQ2YLQR4aYHNSseu32QrwQN/6CgAgIsB/e458uJlY7 9XctJF7WV6JQZtYDs5rlLvzhchToiQhphQCOI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=AEt4Zk4flaE2eUjN/vK/Kwa5teBuC8HFaioNVnfr/XoWVnGGNlkB5bzMzC62IpvUOj SOd1ES9DuyFmiNJnb7HelayOgj38NPXio45MD8ij1hyWJC5w3vyRnCGYOM1EbSdXVpGc XJWnKQrCwPxL0X20sbvlW/Le7LmOlvewR6MEY= MIME-Version: 1.0 Received: by 10.90.33.15 with SMTP id g15mr7123043agg.5.1242148604758; Tue, 12 May 2009 10:16:44 -0700 (PDT) In-Reply-To: <4A099C8F.60709@kickstone.com> References: <4A0978A3.6030900@fcon.no> <4A099C8F.60709@kickstone.com> Date: Tue, 12 May 2009 13:16:44 -0400 X-Google-Sender-Auth: 3522c74a9f68c7b6 Message-ID: <491f66a50905121016r39d78f29k145e2cc53c498586@mail.gmail.com> Subject: Re: pooled prepared statements From: Dave Cramer To: John Lister Cc: Thomas Finneid , pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016e64ec8fc584d5f0469ba4226 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.928 tagged_above=0 required=5 tests=AWL=-0.927, DATE_IN_PAST_06_12=1.854, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200905/70 X-Sequence-Number: 19620 --0016e64ec8fc584d5f0469ba4226 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, May 12, 2009 at 11:58 AM, John Lister 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. >> >> Is that prepared statement shared among the connections or is it only >> available to that single connection? and more importantly, can many >> connections use that prepared statement concurrently? >> >> If it is shared, then it must be usable by concurrent connections, >> otherwise it will be difficult for the client to know if the statement is >> occupied or not. So I just want to confirm that I understand how the JDBC >> driver works. >> > Once the query usage count exceeds the prepareThreshold parameter, then the > driver does create a "prepare statement object" on the server. This is only > valid for the time the PreparedStatement is open and only on that > connection. So to answer your question, they cannot be shared by multiple > connections. > > You can create your own using the PREPARE and EXECUTE sql commands so long > as you track them across different connections... AFAIK, you can't do that either assuming you mean prepare on one connection and execute on another ? Dave > > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc > --0016e64ec8fc584d5f0469ba4226 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, May 12, 2009 at 11:58 AM, John L= ister <jo= hn.lister@kickstone.com> wrote:
Thomas Finneid wrote:
When a PreparedStatment is created by a pooled connection, as far as I unde= rstand if, that creation happens on the server side, and a reference, of so= rts, is returned to the client jdbc.

Is that prepared statement shared among the connections or is it only avail= able to that single connection? and more importantly, can many connections = use that prepared statement concurrently?

If it is shared, then it must be usable by concurrent connections, otherwis= e it will be difficult for the client to know if the statement is occupied = or not. So I just want to confirm that I understand how the JDBC driver wor= ks.
Once the query usage count exceeds the prepareThreshold parameter, then the= driver does create a "prepare statement object" on the server. T= his is only valid for the time the PreparedStatement is open and only on th= at connection. So to answer your question, they cannot be shared by multipl= e connections.

You can create your own using the PREPARE and EXECUTE sql commands so long = as you track them across different connections...

AFAI= K, you can't do that either assuming you mean prepare on one connection= and execute on another ?

Dave


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

--0016e64ec8fc584d5f0469ba4226--