pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC memory usage
3+ messages / 3 participants
[nested] [flat]

* JDBC memory usage
@ 2004-07-23 18:20  Bill Schneider <bschneider@vecna.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Bill Schneider @ 2004-07-23 18:20 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,

I noticed that I keep running out of memory when trying to run a query 
that returns 100,000 rows or so.

Searching the archives, it seems that the JDBC driver reads the entire 
ResultSet into memory at once rather than using cursors.  This is 
definitely not the desired behavior for this particular query.

Has this been fixed recently?  I'm using PostgreSQL 7.3.4 with the 
corresponding JDBC driver.

Thanks!

-- Bill
-- 
Bill Schneider
Chief Architect

Vecna Technologies
5004 Lehigh Rd., Suite B
College Park, MD 20740
bschneider@vecna.com
t: 301-864-7253 x1140
f: 301-699-3180




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: JDBC memory usage
@ 2004-07-23 18:36  jao@geophile.com
  parent: Bill Schneider <bschneider@vecna.com>
  1 sibling, 0 replies; 3+ messages in thread

From: jao@geophile.com @ 2004-07-23 18:36 UTC (permalink / raw)
  To: Bill Schneider <bschneider@vecna.com>; +Cc: pgsql-jdbc

Quoting Bill Schneider <bschneider@vecna.com>:

> Hello,
> 
> I noticed that I keep running out of memory when trying to run a query 
> that returns 100,000 rows or so.
> 
> Searching the archives, it seems that the JDBC driver reads the entire 
> ResultSet into memory at once rather than using cursors.  This is 
> definitely not the desired behavior for this particular query.
> 
> Has this been fixed recently?  I'm using PostgreSQL 7.3.4 with the 
> corresponding JDBC driver.

I ran into this problem. The driver developers informed me that
this problem is fixed in 7.4, and that the new driver can be used
with a 7.3 server. (This exchange should be in the pgsql-jdbc
archives.)

Jack Orenstein

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: JDBC memory usage
@ 2004-07-24 00:11  Oliver Jowett <oliver@opencloud.com>
  parent: Bill Schneider <bschneider@vecna.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Oliver Jowett @ 2004-07-24 00:11 UTC (permalink / raw)
  To: Bill Schneider <bschneider@vecna.com>; +Cc: pgsql-jdbc

Bill Schneider wrote:
> Hello,
> 
> I noticed that I keep running out of memory when trying to run a query 
> that returns 100,000 rows or so.
> 
> Searching the archives, it seems that the JDBC driver reads the entire 
> ResultSet into memory at once rather than using cursors.  This is 
> definitely not the desired behavior for this particular query.
> 
> Has this been fixed recently?  I'm using PostgreSQL 7.3.4 with the 
> corresponding JDBC driver.

Do all of:

- use current development drivers and a 7.4 server, or pre-build-302 
drivers and a 7.2/7.3/7.4 server
- call Connection.setAutoCommit(false)
- create statements that produce resultsets of type TYPE_FORWARD_ONLY
- call Statement.setFetchSize(<positive integer>)
- use queries that consist of a single SELECT with no trailing ';' (only 
a requirement if using older drivers)

Then the driver should use cursors to batch access to the resultset.

-O



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-07-24 00:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23 18:20 JDBC memory usage Bill Schneider <bschneider@vecna.com>
2004-07-23 18:36 ` jao@geophile.com
2004-07-24 00:11 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox