pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Bob Damato <bob_damato@coxtarget.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC Overhead
Date: Tue, 1 Aug 2006 20:53:07 -0400
Message-ID: <AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com> (raw)
In-Reply-To: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com>
References: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com>

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 <unnamed>  [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
>

view thread (5+ messages)  latest in thread

Message-ID: <AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com>
Permalink:  ../AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com/
Also on:    postgresql.org/message-id/AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, bob_damato@coxtarget.com
  Subject: Re: JDBC Overhead
  In-Reply-To: <AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com>
  References: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com> <AFECC58C-9A1D-403A-B596-11AF472AECAC@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox