From: | "Patric Bechtel" <bechtel(at)ipcon(dot)de> |
---|---|
To: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Why is JDBC so slow? [Viruschecked] |
Date: | 2003-09-02 21:13:41 |
Message-ID: | 20030902211420.E01EBD1B8B4@svr1.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 for such 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 with the OS.
- - spit out the values as you get them, directly. No intermediate array. An not that big ones (this one goes to survivor or 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, the program 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-----
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2003-09-02 21:59:51 | Re: Why is JDBC so slow? |
Previous Message | Joseph Shraibman | 2003-09-02 20:24:32 | Re: Why is JDBC so slow? |