Re: Why is JDBC so slow? [Viruschecked] - Mailing list pgsql-jdbc

From Patric Bechtel
Subject Re: Why is JDBC so slow? [Viruschecked]
Date
Msg-id 20030902211420.E01EBD1B8B4@svr1.postgresql.org
Whole thread Raw
In response to Why is JDBC so slow?  (Joseph Shraibman <jks@selectacast.net>)
List pgsql-jdbc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Joseph,

the question rather is: why are you coding THAT inefficient?
What you are doing, is summing up all dead-time in your program together,
because you are:
- - querying the database without a cursor. Please try 7.4 driver with setFetchSize()
- - you call getColumnCount(), which needs to load ALL objects from the server and count them.
- - you are creating a HUGE array of objects, which is already done by the driver, btw.
- - after you've swallowed all these things one after another, you spit it out in a quite inefficient manner (at least
forsuch a huge amount of data). 

So:
- - do NOT use getColumnCount. psql doesn't use that, too.
- - use a buffered outputstream. That's a java issue, ok, but hey, this is a virtual machine. So try to omit ping-pong
withthe OS. 
- - spit out the values as you get them, directly. No intermediate array. An not that big ones (this one goes to
survivoror even old gen heap, so SLOW!). 
- - as hotspot compiles on the fly, try running the test several times, and see what the performance does. Normally,
theprogram get's faster after 5-10 runs, in  
case of -server after 10-20, but then... whow.

hope that helps...

Patric


-----BEGIN PGP SIGNATURE-----
Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.

iQA/AwUBP1T59nxoBrvMu8qQEQIAjACeNU98QPbYsLHY2Pjyo6haXK5laF0AoNax
oGPWXeUzSwjTh8EwQnzzICeR
=NA69
-----END PGP SIGNATURE-----



pgsql-jdbc by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: Why is JDBC so slow?
Next
From: Oliver Jowett
Date:
Subject: Re: Why is JDBC so slow?