Skip site navigation (1) Skip section navigation (2)

Re: Queries with large ResultSets

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Jack Orenstein <jao(at)geophile(dot)com>
Cc: psql-jdbc(at)postgresql(dot)org
Subject: Re: Queries with large ResultSets
Date: 2004-05-20 04:55:14
Message-ID: 40AC3A32.40000@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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

In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-05-20 16:01:09
Subject: Re: Queries with large ResultSets
Previous:From: Jack OrensteinDate: 2004-05-19 21:29:00
Subject: Queries with large ResultSets

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group