Re: JDBC Overhead - Mailing list pgsql-jdbc

From Guy Rouillier
Subject Re: JDBC Overhead
Date
Msg-id D4D1632DC736E74AB95FE78CD609007923AFD7@mtxexch01.add0.masergy.com
Whole thread Raw
In response to JDBC Overhead  ("Bob Damato" <bob_damato@coxtarget.com>)
List pgsql-jdbc
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.

When you say you get 1 ms with mySQL and Sybase, is that just the query
or the JDBC code?  1 ms seems rather fantastic to be able traverse all
those execution paths.

If you are running all three in the same configuration - JDBC app and DB
engine on the same box - then check to make sure they are all either
using the network stack or all bypassing it.

--
Guy Rouillier

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: JDBC Overhead
Next
From: Oliver Jowett
Date:
Subject: Re: JDBC Overhead