Re: jdbc performance tips? - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: jdbc performance tips?
Date
Msg-id 1033552208.1971.122.camel@inspiron.cramers
Whole thread Raw
In response to jdbc performance tips?  ("Brett" <brettonator@excite.com>)
List pgsql-jdbc
Brett,

Sure,

1) I wouldn't worry too much about pg being beta, they put out rock
solid code, and it gets fixed pretty fast.
2) beg, borrow, steal a connection pool implementation, or write one
they aren't that hard, I just use a linked list, and take new
connections from the head, and put them back into the tail.
3) Do not avoid prepared statements, that's all I use, let the driver(s)
worry about how to format a date, or timestamp for you. Plus you will
get the advantage of Barry's new work with pre-parsing the statement.
Caveat( I haven't quite figured out how to deal with re-using statements
yet as this means caching them as well)
4) Postgres jdbc driver has a mechanism for getting the oid This is not
in the jdbc api, so it is non-standard. You need to cast the statement
into a Jdbc2Statement and then call getLastOID to get the oid, in the
case of a sequence number you can get the sequence number first and then
insert it. This does require two trips.

Dave

On Wed, 2002-10-02 at 03:10, Brett wrote:
>  Does anyone have performance tips for someone who is writing a jdbc app from scratch?  I'm open to any jdbc versions
andI'd prefer if the postgresql server isn't beta.  Should I avoid prepared statements?  What if I want to get the
sequenceID for an insert, do I need two roundtrips, one for getting the sequence ID, another for the insert?  Don't
mostdatabases allow you to do one insert to get the sequence ID, implementing it with one round trip?Thanks for any
help/tips.
>
> ------------------------------------------------
> Changed your e-mail?  Keep your contacts!  Use this free e-mail change of address service from Return Path.  Register
now!




pgsql-jdbc by date:

Previous
From: "Brett"
Date:
Subject: jdbc performance tips?
Next
From: Nic Ferrier
Date:
Subject: installation failure using ANT with 7.3 CVS