X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 45E689FB1C3 for ; Tue, 1 Aug 2006 21:53:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 67812-02 for ; Tue, 1 Aug 2006 21:53:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id F41F99FB1B9 for ; Tue, 1 Aug 2006 21:53:09 -0300 (ADT) Received: (qmail 28522 invoked from network); 2 Aug 2006 00:53:08 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 2 Aug 2006 00:53:08 -0000 In-Reply-To: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com> References: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: multipart/alternative; boundary=Apple-Mail-36-79128420 Message-Id: Cc: From: Dave Cramer Subject: Re: JDBC Overhead Date: Tue, 1 Aug 2006 20:53:07 -0400 To: Bob Damato X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.496 tagged_above=0 required=5 tests=HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/4 X-Sequence-Number: 15531 --Apple-Mail-36-79128420 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Bob, On other systems try putting the start time before the prepareStatement Depending on the system they will parse the statement in the prepare, we defer server side parsing until the execute. Also what is the overhead of a second executeQuery ? Dave On 1-Aug-06, at 4:05 PM, Bob Damato wrote: > It appears to me as if there is quite a bit of overhead with the > Postgres JDBC driver when compared with other JDBC drivers. This > simple piece of code shows me something very odd: > > ------------------------------------------------------- > ps = con.prepareStatement("SELECT 1"); > long execStart = System.currentTimeMillis(); > rs = ps.executeQuery(); > System.err.println ("Query executed in " + (System.currentTimeMillis > () - execStart) + "ms"); > -------------------------------------------------------- > > Result of this code is: > Query executed in 57ms > > But with duration logging enabled on the database side, I can see > that the database side processing time was less than 1 ms. > > LOG: duration: 0.073 ms statement: EXECUTE [PREPARE: > SELECT 1] > > When I run this same code against a mySQL or Sybase database, I get > 1ms execution time. Am I missing some bit of tuning that I can do > with the database or the JDBC driver to eliminate that 50+ms of > latency? > > I am running postgres 8.1.4 on solaris and I've tried all 3 JDBC > drivers. The java program is running on the same server as the > database so I don't believe there is any network latency involved. > > Thanks!! > > > ______________________________________________________________________ > _______________ > Bob > Damato > Cox Target Media > Internet Technology > Manager > Largo, Florida > > Our greatest glory is not in never falling, but in rising every > time we fall. -- Confucius > --Apple-Mail-36-79128420 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Bob,

On other systems try = putting the start time before the prepareStatement

Depending on the system = they will parse the statement in the prepare, we defer server side = parsing until the execute.

Also what is the overhead = of a second executeQuery ?

Dave
On = 1-Aug-06, at 4:05 PM, Bob Damato wrote:

It appears to me as if there is quite a bit of = overhead with the Postgres JDBC driver when compared with other JDBC = drivers. This simple piece of code shows me something very = odd:

-------------------------------------------------------
ps =3D = con.prepareStatement("SELECT 1");
long execStart =3D System.currentTimeMillis(); =
rs =3D ps.executeQuery(); =
System.err.println ("Query executed = in " + (System.currentTimeMillis() - execStart) + "ms"); =
--------------------------------------------------------

Result of this code = is:
Query executed in = 57ms

But with duration = logging enabled on the database side, I can see that the database side = processing time was less than 1 ms.

LOG:=A0 duration: 0.073 ms=A0 statement: EXECUTE = <unnamed>=A0 [PREPARE:=A0 SELECT 1]

When I run this same code against a mySQL or Sybase = database, I get 1ms execution time. Am I missing some bit of tuning that = I can do with the database or the JDBC driver to eliminate that 50+ms of = latency?

I am running = postgres 8.1.4 on solaris and I've tried all 3 JDBC drivers. The java = program is running on the same server as the database so I don't believe = there is any network latency involved.

Thanks!!


___________________________________________________________= __________________________
Bob = Damato=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Cox Target = Media=A0=A0=A0=A0
Internet Technology = Manager=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0 Largo, Florida

Our greatest glory is not in never falling, but in rising = every time we fall.=A0 -- = Confucius


= --Apple-Mail-36-79128420--