[postgis-users] strange jdbc problem

Gilbert, Antoine AGilbert at korem.com
Thu Jan 26 05:39:34 PST 2006


I have worked with a lot of JDBC drivers, and it's the first one with
this default behavior. 

-----Original Message-----
From: Guido Lemoine [mailto:guido.lemoine at jrc.it] 
Sent: January 26, 2006 3:08 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] strange jdbc problem

If you do such a select as a normal query (in postgresql) you would also
get the whole 500,000 record set. Its display would prob. take some 10
seconds as well (the 19 s in jdbc are the overhead in loading the set in
a
rowset object). The fetchsize in jdbc works, more or less, equivalent
to a "limit" in an sql query.

So, the default behavior is exactly as expected. Maybe it is strange to
load 500,000 records in a Java application.

GL

Gilbert, Antoine wrote:

>A guy pointed me on how to resolve this kind of problem
>
>Here are the explanations
>
>"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."
>
>http://jdbc.postgresql.org/documentation/81/query.html#query-with-curso
r
>
>
>All is ok now. It's a very strange default behavior in my own
>opinion....
>
>-----Original Message-----
>From: Paul Ramsey [mailto:pramsey at refractions.net] 
>Sent: January 25, 2006 4:22 PM
>To: PostGIS Users Discussion
>Subject: Re: [postgis-users] strange jdbc problem
>
>Antoine,
>
>You need to use a forwardonly cursor if you want a fast return.   
>Otherwise the JDBC system is pulling the whole resultset into the  
>client side, for your use.  This is a general postgresql jdbc issue,  
>not a postgis issue, check the jdbc documentation on the postgresql  
>site.
>
>P.
>
>On Jan 25, 2006, at 11:50 AM, Gilbert, Antoine wrote:
>
>  
>
>>Hi
>>
>>
>>I have a single PostGIS table in PostgreSQL
>>
>>
>>This table have 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.
>>
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users at postgis.refractions.net
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>    
>>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>  
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list