Re: ResultSet performance question - Mailing list pgsql-jdbc

From JAlexoid
Subject Re: ResultSet performance question
Date
Msg-id 21070092.post@talk.nabble.com
Whole thread Raw
In response to ResultSet performance question  (Craig Servin <cservin@cromagnon.com>)
Responses Re: ResultSet performance question  (Craig Servin <cservin@cromagnon.com>)
List pgsql-jdbc
A) If you are using PreparedStatement that should involve a conditional index
when parameters are applied, the index will not be used.
B) Have you tries to set the fetch size? (Statement.setFetchSize())
   0 - means all rows will be transferred at once
   more than 0 - effective fetch will be done.



Craig Servin-2 wrote:
>
> 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 rs.next()
> calls
> through the ResultSet to time the execution without any other work being
> done.
>
> 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.
>
> Thanks,
>
> Craig
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>

--
View this message in context: http://www.nabble.com/ResultSet-performance-question-tp21040330p21070092.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


pgsql-jdbc by date:

Previous
From: Andres Ledesma
Date:
Subject: Re: ResultSet performance question
Next
From: Jeremiah Jahn
Date:
Subject: postgresql-8.1-413.jdbc3.jar ignoring setPrepareThreshold();