pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Bob Damato <bob_damato@coxtarget.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC Overhead
Date: Wed, 02 Aug 2006 15:34:24 +1200
Message-ID: <44D01D40.9090002@opencloud.com> (raw)
In-Reply-To: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com>
References: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com>

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



view thread (5+ messages)

Message-ID: <44D01D40.9090002@opencloud.com>
Permalink:  ../44D01D40.9090002@opencloud.com/
Also on:    postgresql.org/message-id/44D01D40.9090002@opencloud.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: oliver@opencloud.com, bob_damato@coxtarget.com
  Subject: Re: JDBC Overhead
  In-Reply-To: <44D01D40.9090002@opencloud.com>
  References: <3C0EE29939948549A093F180634257028F2895@ex-1.coxtarget.com> <44D01D40.9090002@opencloud.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