From: Oliver Jowett <oliver@opencloud.com>
To: mikael-aronsson <mikael-aronsson@telia.com>
Cc: Thomas Dudziak <tomdzk@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Performance problem with timestamps in result sets
Date: Thu, 09 Mar 2006 17:54:44 +0900
Message-ID: <440FED54.4030900@opencloud.com> (raw)
In-Reply-To: <006201c642c2$1f17a610$c29c143e@w128mtec>
References: <224f32340603080537ld424d49l2eea9440594104d3@mail.gmail.com>
<060a01c642bf$b3060220$9001a8c0@zaphod>
<224f32340603080657m35f7c35do34a2c6dc3f1b5f0@mail.gmail.com>
<006201c642c2$1f17a610$c29c143e@w128mtec>
mikael-aronsson wrote:
> I do not think there is much more to do, the timestamp is just a 64 bit
> integer and you say an int takes 570ms/10920 calls and a timestamp takes
> 7130ms/8190 calls, this is about twice as much to get twice as much data.
This is wrong, and not just because your maths is wrong ;-) Timestamps
are not "just a 64 bit integer" on the wire.
getTimestamp() is parsing a string representation of a timestamp
(multiple numeric fields, separators, etc) and massaging it into a
Timestamp in the right timezone (retriving the right Calendar and
converting to a milliseconds-per-epoch value from the individual
components and timezone info)
getInt() is parsing a string representation of a single number.
So I'd expect getTimestamp() to be noticably slower than getInt(), which
is what we see.
Going to binary-format results would help, as then you can transfer the
underlying value directly rather than having the backend format it all
then have the JDBC driver parse it, but noone has done that yet. One big
obstacle is that binary format results are somewhat all-or-nothing, it's
tricky to do it for only a single datatype. You'd also still have to do
some timezone conversion work, I think.
-O
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, mikael-aronsson@telia.com, tomdzk@gmail.com
Subject: Re: Performance problem with timestamps in result sets
In-Reply-To: <440FED54.4030900@opencloud.com>
References: <224f32340603080537ld424d49l2eea9440594104d3@mail.gmail.com> <060a01c642bf$b3060220$9001a8c0@zaphod> <224f32340603080657m35f7c35do34a2c6dc3f1b5f0@mail.gmail.com> <006201c642c2$1f17a610$c29c143e@w128mtec> <440FED54.4030900@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