X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C75629DC8AF for ; Thu, 9 Mar 2006 04:55:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08322-06 for ; Thu, 9 Mar 2006 04:55:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 2BBD29DC886 for ; Thu, 9 Mar 2006 04:55:20 -0400 (AST) Received: from 221x253x225x162.ap221.ftth.ucom.ne.jp ([221.253.225.162] helo=[192.168.1.110]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1FHGvS-0004kH-06; Thu, 09 Mar 2006 21:55:14 +1300 Message-ID: <440FED54.4030900@opencloud.com> Date: Thu, 09 Mar 2006 17:54:44 +0900 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: mikael-aronsson CC: Thomas Dudziak , pgsql-jdbc@postgresql.org Subject: Re: Performance problem with timestamps in result sets References: <224f32340603080537ld424d49l2eea9440594104d3@mail.gmail.com> <060a01c642bf$b3060220$9001a8c0@zaphod> <224f32340603080657m35f7c35do34a2c6dc3f1b5f0@mail.gmail.com> <006201c642c2$1f17a610$c29c143e@w128mtec> In-Reply-To: <006201c642c2$1f17a610$c29c143e@w128mtec> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/45 X-Sequence-Number: 14826 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