Re: Re: JDBC Performance - Mailing list pgsql-general

From Tim Kientzle
Subject Re: Re: JDBC Performance
Date
Msg-id 39D3EB28.E39675A4@acm.org
Whole thread Raw
In response to Re: JDBC Performance  (Tim Kientzle <kientzle@acm.org>)
List pgsql-general
Gunnar R|nning wrote:
> I think we can improve the performance of the JDBC driver alot still.
> ... The remaining largest bottleneck in my JDBC codebase now is related to
> byte/char conversions in the Sun JDK implementation. My profiler tells me
> that Sun JDK 1.2.2 for some reasons create new instances of the converter
> class every time you do an conversion...

A custom converter may not really help; I experimented with that for
another project and it really didn't make that big of a difference.

You might get some advantage by manually handling the converter object,
keeping a reference to it in the database handle so you don't have to
re-instantiate that class every time. That might help.

You might be able to optimize out some char-to-byte conversions.
For example, if someone "prepares" a SQL statement, you can pre-convert
the entire statement (less placeholders) into bytes, then
convert only the individual arguments; this would speed up
repeated uses of prepared statements.  (I.e., break the original
statement
at ? placeholders, convert each block of static text into bytes,
store the statement as a list of byte[].  When someone executes
a statement, convert just the arguments into bytes and emit the
complete statement.)  I've had very good luck with this strategy
for building and caching mostly-static web pages within Java servlets.

                - Tim

pgsql-general by date:

Previous
From: Alejandro Federico Pérez López
Date:
Subject: A newbie question
Next
From: Alain Black
Date:
Subject: RE: A newbie question