Re: Performance of setTimestamp and getTimestamp - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Performance of setTimestamp and getTimestamp
Date
Msg-id Pine.BSO.4.56.0412200323500.25555@leary.csoft.net
Whole thread Raw
In response to Performance of setTimestamp and getTimestamp  (Bryce Ewing <brycenz@gmail.com>)
List pgsql-jdbc

On Mon, 20 Dec 2004, Bryce Ewing wrote:

> Not sure if this has been mentioned before but I have found that in my
> development an extraordinary amount of time is being spent in these
> two methods, just to give you an idea in two cases recently during
> bulk operations I have found that 21% and 72% of the time to do the
> bulk loads/bulk processing has been spent in setTimestamp and
> getTimestamp respectively.

That's not good.

> I first found that setTimestamp was going to be a performance issue
> for me so I decided to see if I could find a faster way of doing it,
> from the test code below I found that I had a 3 times improvement in
> just using SimpleDateFormat to format the timestamp (the setTimestamp
> method was copied from the jdbc drivers with a couple of small
> changes).
>
> Note that at present I am using 7.4 and so I am not so sure how this
> fits in with the push for 8.
>

I rewrote both the set/getTimestamp code for 8.0 last week.  Using your
test I've made some further modifications and I now see numbers like so
from my attached modification of your test:

setTimestamp74 took: 4930
setTimestamp80 took: 1999
format took: 1503

Note that your method does not correctly handle BC dates, dates past 9999
or fractional seconds beyond milliseconds which the 8.0 code does.  If you
have any further ideas and improvements we would definitely like to hear
about them.

Kris Jurka

Attachment

pgsql-jdbc by date:

Previous
From: Bryce Ewing
Date:
Subject: Performance of setTimestamp and getTimestamp
Next
From: "Barry Lind"
Date:
Subject: Re: Bug in JDBC-Driver?