Re: Performance problem iterating a resultset

From: Barry Lind <blind(at)xythos(dot)com>
To: Teofilis Martisius <teo(at)teohome(dot)lzua(dot)lt>
Cc: Riyaz(at)umapinc(dot)com, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Performance problem iterating a resultset
Date: 2002-10-19 01:42:27
Message-ID: 3DB0B883.8010000@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Teofilis,

I have spent some time looking at your patch and trying it on different
JVMs. I was amazed how poorly the sun JVM handles this case. In fact I
saw performance differences of as much as 40X between the your code and
the sun code. (I think that was on a 1.2 jvm).

So I am inclined to include this patch. The reason I haven't yet, is
that I am investigating setting the 'client_encoding' parameter on the
server which would cause the server to encode everything to/from UTF8 so
that the client could always use this faster code. This would only be
possible if using a 7.3 server. Earlier releases didn't always have
support for this built in since it was a compile time parameter. But my
understanding is that in 7.3 the server always has this capability and
it is no longer a compile time option.

thanks,
--Barry

Teofilis Martisius wrote:
> Hi,
>
> While testing PostgreSQL JDBC I have noticed that it uses byte[]->String
> conversion everywhere via 'new String(byte[], encoding)' constructor. I
> found the implementation of that constructor painfully slow at least in
> Sun's JDK 1.3.1 and 1.4.0, a bit better in gcj 3.2. I have made a patch
> that uses my own UTF-8 Unicode byte[]->String constructor and it speeds
> up iterating a resultset ~1.5-2x on Sun's JDK.
>
> Please confirm if anyone has similar experience. I will post the patch
> to this mailing list if you are interested in it. Too bad it only works
> with Unicode databases, and uses the default String constructor for other
> character codings.
>
> Teofilis Martisius,
> teo(at)teohome(dot)lzua(dot)lt
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Harter 2002-10-19 01:47:59 Problem compiling on HP/Compaq Tru64 UNIX
Previous Message Tom Lane 2002-10-19 00:46:34 Re: cvs retrieval of earthdistance

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2002-10-19 02:30:40 /contrib/retep to gborg
Previous Message Barry Lind 2002-10-19 01:33:22 Re: Getting a ResultSet for a refcursor element.