Skip site navigation (1) Skip section navigation (2)

ResultSet performance question

From: Craig Servin <cservin(at)cromagnon(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ResultSet performance question
Date: 2008-12-16 19:13:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
I'm having a performance issue with Postgresql, but only when using the JDBC 
driver.  I'm looking for any suggestions.

I have a very simple query that returns about 7000 rows from a temp table.  
Using psql the query returns in under 3 seconds.  Using the JDBC driver it 
takes around 30 seconds to run the same query.

I have looked at the query plan using both methods of execution and they are 
identical.  I have played around with setFetchSize() and used  
con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); 
But, since I am trying to get all of the results and it is total runtime I am 
worried about server side cursors don't seem applicable.

I have also created a Java class that does nothing but issue calls 
through the ResultSet to time the execution without any other work being 

I can't believe that I am not doing something wrong as the difference in 
execution time is extreme.  Is this normal?

Any advice would be greatly appreciated.




pgsql-jdbc by date

Next:From: Albe LaurenzDate: 2008-12-17 07:41:13
Subject: Re: ResultSet performance question
Previous:From: LucasDate: 2008-12-16 10:24:31
Subject: Re: JNDI Tomcat and PostgreSQL Error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group