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 1DF035644C for ; Wed, 9 Mar 2005 09:14:50 +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 24492-06 for ; Wed, 9 Mar 2005 09:14:44 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 785D0563A4 for ; Wed, 9 Mar 2005 09:14:43 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 70so113433wra for ; Wed, 09 Mar 2005 01:14:45 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=U1tca/bCUg/aaG3H+sVdDa9jgewJhEle8+JYoZOfijMNyF6ICzSFyexvEoj/LJzTnkAFZqmk5p04J/2RpuaLQrTJC+eCmfFoiN1GHjT+UGyzQYvLK3UZyTFAZJDppf6836lic13nVqArwH6egAsoZERUZQo4/SHwe5S94RNnvWs= Received: by 10.54.71.17 with SMTP id t17mr554935wra; Wed, 09 Mar 2005 01:14:45 -0800 (PST) Received: by 10.54.31.54 with HTTP; Wed, 9 Mar 2005 01:14:45 -0800 (PST) Message-ID: <2989532e050309011430062873@mail.gmail.com> Date: Wed, 9 Mar 2005 14:44:45 +0530 From: Antony Paul Reply-To: Antony Paul To: Silvio Bierman Subject: Re: FW: PreparedStatement#setString on non-string parameters Cc: PostgreSQL JDBC In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05030819582e7c8d0a@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.734 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200503/79 X-Sequence-Number: 12471 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. rgds Antony Paul On Wed, 9 Mar 2005 10:08:10 +0100, Silvio Bierman wrote: > Hello Antony, > > I honestly don't know. Oliver Jowett told me that the 8.0 driver is the > first to use server side prepared statements, which is good I guess. I do > not know the internals of PostgreSQL server statement caching but usually > using server side prepared statements is faster than emulating prepared > statements in the JDBC driver. In cases where statements are really > exectuted once only and the PreparedStatement is used for parameter > substitution convenience only (which is a very good reason, BTW) emulated > statements are usually faster. > > I just tested with the 7.4 driver and that actually works fine. It also > fixed the setString error I got when using the James mail server with the > 8.0 driver... > > I can not say anything about performance in comparison to the 8.0 driver > yet. Oliver mentioned poor blob-performance in the pre-8 protocol. I am not > very happy with that since we use blobs quite frequently, be it that they > are are never very large. > > I will be doing some tests with the 8.0 driver in combination with a > implicit cast versus the 7.4 driver. I will keep you posted... > > Regards, > > Silvio Bierman > > @-----Original Message----- > @From: pgsql-jdbc-owner@postgresql.org > @[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Antony Paul > @Sent: Wednesday, March 09, 2005 4:59 AM > @To: Oliver Jowett > @Cc: Silvio Bierman; PostgreSQL JDBC > @Subject: Re: FW: [JDBC] PreparedStatement#setString on non-string > @parameters > @ > @ > @Does this new stuff added in 8.0 driver adds to performance ?. I had > @this setString() problem and I tested 7.4.x driver which works and > @performs better than 8.0 driver. > @ > @ > @ > @On Wed, 09 Mar 2005 10:47:34 +1300, Oliver Jowett > @ wrote: > @> Silvio Bierman wrote: > @> > @> > Either the JDBC drivers for the databases I mentioned earlier do the > @> > conversion or the database backends do it on the server side. > @Any way, this > @> > works in all cases. PostgreSQL is the first database to break our > @> > application due to this behaviour. We have had problems on > @earlier versions > @> > of MySQL because of lack of subselect support etc. but never > @these issues. > @> > @> I'd suggest using CAST in your SQL -- that in theory should work > @> everywhere and reflects your application's intent (to interpret a string > @> as a numeric value). > @> > @> The problem with reverting to the old way of doing parameters (direct > @> text substitution into the query) is that we cannot take advantage of > @> most of the new stuff in the V3 protocol -- that means no server-side > @> prepared statement reuse, no low-overhead transfer of large parameters, > @> and reduced support for cursor-based resultsets. > @> > @> -O > @> > @> ---------------------------(end of broadcast)--------------------------- > @> TIP 9: the planner will ignore your desire to choose an index > @scan if your > @> joining column's datatypes do not match > @> > @ > @ > @-- > @rgds > @Antony Paul > @http://www.geocities.com/antonypaul24/ > @ > @---------------------------(end of broadcast)--------------------------- > @TIP 3: if posting/reading through Usenet, please send an appropriate > @ subscribe-nomail command to majordomo@postgresql.org so that your > @ message can get through to the mailing list cleanly > > -- rgds Antony Paul http://www.geocities.com/antonypaul24/