X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 61654D1CCD6 for ; Thu, 20 May 2004 12:34:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98621-01 for ; Thu, 20 May 2004 12:34:29 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 26097D1C4C3 for ; Thu, 20 May 2004 12:31:08 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 5A20D453BB; Thu, 20 May 2004 12:31:07 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 57916453B6 for ; Thu, 20 May 2004 12:31:07 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Thu, 20 May 2004 02:00:44 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 6F93A3D418 for ; Thu, 20 May 2004 02:00:43 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Thu, 20 May 2004 02:00:43 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Thu, 20 May 2004 01:56:15 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3C779D1D103 for ; Thu, 20 May 2004 01:56:15 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71402-03 for ; Thu, 20 May 2004 01:55:55 -0300 (ADT) X-Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 989E1D1B28B for ; Thu, 20 May 2004 01:55:26 -0300 (ADT) X-Received: from flood.opencloud.co.nz ([192.168.0.31] helo=opencloud.com ident=oliver) by yass.opencloud.co.nz with esmtp (Exim 3.35 #1 (Debian)) id 1BQfaR-0005ts-00; Thu, 20 May 2004 16:55:19 +1200 Message-ID: <40AC3A32.40000@opencloud.com> Date: Thu, 20 May 2004 16:55:14 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jack Orenstein Cc: psql-jdbc@postgresql.org Subject: Re: Queries with large ResultSets References: <40ABD19C.8080109@geophile.com> In-Reply-To: <40ABD19C.8080109@geophile.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Thu, 20 May 2004 12:31:03 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-jdbc@postgresql.org ReSent-Subject: Re: [JDBC] Queries with large ResultSets ReSent-Message-ID: <20040520123103.B5739@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/124 X-Sequence-Number: 10134 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