Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9A43D632967 for ; Sun, 3 May 2009 07:16:03 -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 02740-04 for ; Sun, 3 May 2009 07:15:56 -0300 (ADT) X-Greylist: delayed 00:05:19.059163 by SQLgrey-1.7.6 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mail.postgresql.org (Postfix) with ESMTP id CAFA06327D6 for ; Sun, 3 May 2009 07:16:01 -0300 (ADT) Received: by yx-out-2324.google.com with SMTP id 8so2014812yxg.73 for ; Sun, 03 May 2009 03:16:00 -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=wMZsEmMYjrkeic9FKiWXQNACvyjU+Xg+9YIRUCXrwyA=; b=quURVPzDg0g+soRSwE6hnfp3qkucv64gqXc+QVXmh727v6lpXX5hGSEHo5F0jKYE8L k/km/EdP4FgosBFMrlHT+boR/FaUTc2dCtVp43oidIH4brrFjCghZHpfNxzxo9AItfjF fFEwMvEBAcNHanTq1gZ7pYJrTbpIWKVGtZSEw= 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=xp2mFE/2JXjNcbJEcxKswnG6T7NIhIhxcyftLTL4xHVKw8RHNLowcCsEwI4woT+f/1 5Uo+n0MpIu7aGKZM6XROa4JpFidOPmh3rXioM/OE4XVYB0X1Nm5RP0ll3dDrPPSFRNvL vu2ZN/xCNNQuKcLcO8CPFEzuAOtrHHxfD8hT4= MIME-Version: 1.0 Received: by 10.90.25.11 with SMTP id 11mr3106070agy.74.1241345441095; Sun, 03 May 2009 03:10:41 -0700 (PDT) In-Reply-To: References: <5C2E1645-73B6-4509-96CD-FA77869516AB@noopsis.fr> <49F71EDD.2070200@opencloud.com> <02437794-A78D-449C-843F-B823195F9623@noopsis.fr> Date: Sun, 3 May 2009 06:10:41 -0400 X-Google-Sender-Auth: f0e53046add9365a Message-ID: <491f66a50905030310j5b4cdcd8jbf4f6e757c2ba580@mail.gmail.com> Subject: Re: Very strange performance decrease when reusing a PreparedStatement From: Dave Cramer To: =?ISO-8859-1?B?UOl0ZXIgS2924WNz?= Cc: =?ISO-8859-1?Q?Fr=E9d=E9rik_Bilhaut?= , Oliver Jowett , pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=00163630e99f0f61710468ff4212 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200905/12 X-Sequence-Number: 19562 --00163630e99f0f61710468ff4212 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit > It appears that the Postgres "server-prepared statement" cannot handle > parameters to the statement. This is really unfortunate, because 99% > of real-life applications will want to re-use the same statement > (template) with different parameters. > > The term "server-prepared statement" itself already indicates that > there may be something skewed about the "local" semantics of > java.sql.PreparedStatements in the Postgres JDBC driver. There is no > notion of "client-prepared statement" in the JDBC API, which conceives > PreparedStatement instances as mere handles to server side objects. > And indeed, Postgres JDBC users have historically been using > java.sql.PreparedStatements for its side-effect of preventing SQL > injection rather than for the purpose the JDBC API designers had in > mind with this class. > I'm not sure where this hypothesis is coming from. Postgresql server prepared statements can certainly handle parameters. What makes you think it can't ? Dave --00163630e99f0f61710468ff4212 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
It appears that the Postgres "server-prepared statement" cannot handle
parameters to the statement. This is really unfortunate, because 99%
of real-life applications will want to re-use the same statement
(template) with different parameters.

The term "server-prepared statement" itself already indicates that
there may be something skewed about the "local" semantics of
java.sql.PreparedStatements in the Postgres JDBC driver. There is no
notion of "client-prepared statement" in the JDBC API, which conceives
PreparedStatement instances as mere handles to server side objects.
And indeed, Postgres JDBC users have historically been using
java.sql.PreparedStatements for its side-effect of preventing SQL
injection rather than for the purpose the JDBC API designers had in
mind with this class.

I'm not sure where this hypothesis is coming from. Postgresql server prepared statements can certainly handle parameters.

What makes you think it can't ?

Dave

--00163630e99f0f61710468ff4212--