From: Oliver Jowett <oliver@opencloud.com>
To: Bill Schneider <bschneider@vecna.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC memory usage
Date: Sat, 24 Jul 2004 12:11:34 +1200
Message-ID: <4101A936.9040604@opencloud.com> (raw)
In-Reply-To: <410156D7.50109@vecna.com>
References: <410156D7.50109@vecna.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, bschneider@vecna.com
Subject: Re: JDBC memory usage
In-Reply-To: <4101A936.9040604@opencloud.com>
References: <410156D7.50109@vecna.com> <4101A936.9040604@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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