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 50BB59DC835 for ; Wed, 8 Mar 2006 09:37:50 -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 06342-06 for ; Wed, 8 Mar 2006 09:37:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.194]) by postgresql.org (Postfix) with ESMTP id E50C59DC836 for ; Wed, 8 Mar 2006 09:37:46 -0400 (AST) Received: by uproxy.gmail.com with SMTP id c2so90100ugf for ; Wed, 08 Mar 2006 05:37:50 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=b9JcnZKPx7Bf9xbul60Jr2WXKqh0ugHRnmtOwVmZS3Z1jvroxW4YL3yEjM5XrmB2zp28xIW1gHbsib/n6XbKRNRkYmbins+lOok5Y3x0uI5GGUd2arm4mln74IdwR4Fey8HRqrSz1RnLpaXDpA8hYHZF51IJT4fN0+wkGn19QzE= Received: by 10.67.31.1 with SMTP id i1mr445203ugj; Wed, 08 Mar 2006 05:37:50 -0800 (PST) Received: by 10.67.30.2 with HTTP; Wed, 8 Mar 2006 05:37:50 -0800 (PST) Message-ID: <224f32340603080537ld424d49l2eea9440594104d3@mail.gmail.com> Date: Wed, 8 Mar 2006 14:37:50 +0100 From: "Thomas Dudziak" To: pgsql-jdbc@postgresql.org Subject: Performance problem with timestamps in result sets MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/29 X-Sequence-Number: 14810 Hi, while profiling an application of ours, I noticed a performance problem with the PostgreSQL JDBC driver (the same for any version: 8.0, 8.1, 8.2dev-501). In short, whenever the ResultSet contains a timestamp value, the JDBC driver takes nearly one second to extract it (this is against a 8.0 on Windows, database and application on the same machine; with a non-development configuration, the number would be a bit lower). The profiling shows that the culprit is -> AbstractJdbc2ResultSet.getTimestamp(int) : 7130ms | 8190 calls -> TimestampUtils.loadCalendar(GregorianCalendar, String, String) : 5417ms | 8190 calls -> TimestampUtils.firstNonDigit : 2163ms | 49140 times -> TimestampUtils.number(String, int, int) : 1562ms | 49140 times Now my question is, is there something to make this faster ? Nearly 1sec for a ResulSet.getTimestamp call is too much for us. cheers, Tom