Why is JDBC so slow? - Mailing list pgsql-jdbc

From Joseph Shraibman
Subject Why is JDBC so slow?
Date
Msg-id bj2m4q$1l2c$1@news.hub.org
Whole thread Raw
Responses Re: Why is JDBC so slow? [Viruschecked]
Re: Why is JDBC so slow?
List pgsql-jdbc
For this test I created a table named tt with ten entries in it.  These
selects thus select 10^6 rows.  As you can see time for jdbc is much
slower than psql.  Why is this?

The code for JDBCclient is at: http://www.tupari.net/JDBCclient.java

Tests were run on pg 7.4b2 on a redhat 9 machine with java 1.4.2_01

]$ time psql -c "select 'blah' from tt tta, tt ttb, tt ttc, tt ttd, tt
tte, tt ttf;" playpen > /dev/null

real    0m4.321s
user    0m1.390s
sys     0m0.150s
]$ time java -Xmx256m JDBCclient -U postgres -h localhost -c "select
'blah' from tt tta, tt ttb, tt ttc, tt ttd, tt tte, tt ttf;" playpen >
/dev/null

real    0m27.271s
user    0m21.040s
sys     0m0.710s
]$ time psql -c "select 1 from tt tta, tt ttb, tt ttc, tt ttd, tt tte,
tt ttf;" playpen > /dev/null

real    0m5.125s
user    0m1.660s
sys     0m0.030s
]$ time java -Xmx256m JDBCclient -U postgres -h localhost -c "select 1
from tt tta, tt ttb, tt ttc, tt ttd, tt tte, tt ttf;" playpen > /dev/null

real    0m26.462s
user    0m20.180s
sys     0m0.970s


pgsql-jdbc by date:

Previous
From: Michael Stephenson
Date:
Subject: Re: A JDBC bug or problem relating to string length in Java
Next
From: Fernando Nasser
Date:
Subject: Re: Why is JDBC so slow?