Re: experience sharing: select query returns more records than necessary - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: experience sharing: select query returns more records than necessary
Date
Msg-id 491f66a50901200407o18a8d0basf0cee02f511482eb@mail.gmail.com
Whole thread Raw
In response to experience sharing: select query returns more records than necessary  (Kent Tong <kent@cpttm.org.mo>)
Responses Re: experience sharing: select query returns more records than necessary  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc



In contrast, if I issue the query on the DB server in the psql console, it
returns records almost immediately. Finally I found that it is because the
postgreSQL JDBC driver is pre-fetching a lot (all?) of the records. To fix
the problem, one can call setFetchSize(50) on the statement.

psql doesnt do anything any differently. It just doesn't have to create objects, and you are likely local to the network.

And yes, setFetchSize is the correct way to handle this.

Dave

pgsql-jdbc by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: JDBC exception, incompatible types in simple stored procedure.
Next
From: Oliver Jowett
Date:
Subject: Re: experience sharing: select query returns more records than necessary