pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Jack Orenstein <jao@geophile.com>
Cc: psql-jdbc@postgresql.org
Subject: Re: Queries with large ResultSets
Date: Thu, 20 May 2004 16:55:14 +1200
Message-ID: <40AC3A32.40000@opencloud.com> (raw)
In-Reply-To: <40ABD19C.8080109@geophile.com>
References: <40ABD19C.8080109@geophile.com>

Jack Orenstein wrote:
> If I'm reading the source code correctly, the PostgreSQL 7.3.4 JDBC
> driver creates a ResultSet by evaluating the entire query, and putting
> all the rows into a Vector. ResultSet.next() iterates over the
> Vector. Is that in fact what is happening?

That's probably true for the 7.3.4 driver, which is quite old now.

The latest 7.4 drivers (which will work against a 7.3 server) will use a 
cursor to fetch the resultset incrementally when:

  - the statement fetchsize is non-zero; and
  - autocommit is off (and
  - the statement is TYPE_FORWARD_ONLY; and
  - the query is a single SELECT

There's also been a patch posted recently (check the archives) that 
allows use of cursors with scrollable resultsets.

-O



view thread (13+ messages)  latest in thread

Message-ID: <40AC3A32.40000@opencloud.com>
Permalink:  ../40AC3A32.40000@opencloud.com/
Also on:    postgresql.org/message-id/40AC3A32.40000@opencloud.com

 · 

reply

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, jao@geophile.com, psql-jdbc@postgresql.org
  Subject: Re: Queries with large ResultSets
  In-Reply-To: <40AC3A32.40000@opencloud.com>
  References: <40ABD19C.8080109@geophile.com> <40AC3A32.40000@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