From: | Dave Cramer <Dave(at)micro-automation(dot)net> |
---|---|
To: | brettonator(at)excite(dot)com |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: jdbc performance tips? |
Date: | 2002-10-02 09:50:07 |
Message-ID: | 1033552208.1971.122.camel@inspiron.cramers |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 and I'd prefer if the postgresql server isn't beta. Should I avoid prepared statements? What if I want to get the sequence ID for an insert, do I need two roundtrips, one for getting the sequence ID, another for the insert? Don't most databases 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Nic Ferrier | 2002-10-02 11:50:42 | installation failure using ANT with 7.3 CVS |
Previous Message | Jeroen Olthof | 2002-10-02 08:02:12 | This method is not yet implemented. |