Re: strange problem - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: strange problem
Date
Msg-id Pine.BSO.4.61.0601251518480.20277@leary.csoft.net
Whole thread Raw
In response to strange problem  ("Gilbert, Antoine" <AGilbert@korem.com>)
List pgsql-jdbc

On Wed, 25 Jan 2006, Gilbert, Antoine wrote:

> I have a single PostGIS table in PostgreSQL
> This table has like 500000 records
> I use the JDBC driver to only send a quick query without browsing
> resultset and it take forever. For example:
>
> Statement stmt = connection.createStatement();
> ResultSet rs =stmt.executeQuery("select street from \"QCs_polyline\"");
> stmt.close();
>
> This takes 19 sec. Does I am missing something like a configuration on
> the driver? So far I was just testing PostGIS/PostgreSQL with tiny
> tables.
>

By default the JDBC driver will fetch the entire ResultSet before the
executeQuery call returns.  If you don't want this behavior set the
fetchsize appropriately.  See the following for more information:

http://jdbc.postgresql.org/documentation/81/query.html#query-with-cursor

Kris Jurka

pgsql-jdbc by date:

Previous
From: "Gilbert, Antoine"
Date:
Subject: strange problem
Next
From: Oliver Jowett
Date:
Subject: Re: Socket read fails