Re: experience sharing: select query returns more records than necessary

From: "Dave Cramer" <pg(at)fastcrypt(dot)com>
To: "Kent Tong" <kent(at)cpttm(dot)org(dot)mo>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: experience sharing: select query returns more records than necessary
Date: 2009-01-20 12:07:02
Message-ID: 491f66a50901200407o18a8d0basf0cee02f511482eb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2009-01-20 12:34:18 Re: experience sharing: select query returns more records than necessary
Previous Message uprooter 2009-01-20 09:24:55 Re: JDBC exception, incompatible types in simple stored procedure.