Why is JDBC so slow?

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Why is JDBC so slow?
Date: 2003-09-02 18:05:15
Message-ID: bj2m4q$1l2c$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fernando Nasser 2003-09-02 18:41:47 Re: Why is JDBC so slow?
Previous Message Michael Stephenson 2003-09-02 09:22:37 Re: A JDBC bug or problem relating to string length in Java