Обсуждение: strange problem

Поиск
Список
Период
Сортировка

strange problem

От
"Gilbert, Antoine"
Дата:

Hi

 

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.

 

Re: strange problem

От
Kris Jurka
Дата:

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

Re: strange problem

От
Andres Ledesma
Дата:
On Wednesday 25 January 2006 08:51 pm, Gilbert, Antoine wrote:
>
> 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.

Did you try to create a function in the database returning the rows you want
to fetch and to use CallableStatement ?

--

Andres Ledesma
=================