Search Postgresql Archives

Re: Cursors and Transactions, why?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 7 Apr 2004, Eric Ridge wrote:

> 
> My real problem is that the JDBC drivers (and I assume this is true for 
> all client interfaces) buffer the results of a SELECT in memory, 
> because the backend pushes out all the tuples as the response.  I'm not 
> dealing with a large number of rows (only a few thousand), but they've 
> very wide, and many contain fields with multi-megabyte data.  In some 
> situations, when I've got a lot of open ResultSets, the JVM throws 
> OutOfMemory errors.
> 

The 7.4 jdbc driver has the ability to use cursors behind the scenes on 
queries.  This is done by calling Statement.setFetchSize(n) to retrieve n 
rows at a time.  There are a number of other restrictions: you must be in 
a transaction and the ResultSet type must be FORWARD_ONLY.  You can use 
the 7.4 jdbc driver against a 7.3 server as well so this may provide some 
relief.

Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux