Re: JDBC Overhead

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Bob Damato <bob_damato(at)coxtarget(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC Overhead
Date: 2006-08-02 03:34:24
Message-ID: 44D01D40.9090002@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Bob Damato wrote:

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

Try a better benchmark, what you are probably measuring there is mostly
classloading, JIT, and similar startup costs. How long does it take on
the 1000th execution?

Also, unless you are specifically measuring query time when reexecuting
the same PreparedStatement many times, you should include the cost of
prepareStatement() in your measurements.

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message ron 2006-08-02 04:05:45 Re: Callablestatement's resulting resultset not scrollable
Previous Message Guy Rouillier 2006-08-02 03:06:33 Re: JDBC Overhead