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 24800D1CCD1 for ; Fri, 21 May 2004 03:15:36 -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 99096-02 for ; Fri, 21 May 2004 03:15:16 -0300 (ADT) Received: from vsmtp2alice.tin.it (vsmtp2alice.tin.it [212.216.176.142]) by svr1.postgresql.org (Postfix) with ESMTP id 6460BD1B360 for ; Fri, 21 May 2004 03:15:14 -0300 (ADT) Received: from host38-124.pool80180.interbusiness.it (80.180.124.38) by vsmtp2alice.tin.it (7.0.027) id 40A257AF000B8AEF; Fri, 21 May 2004 08:14:41 +0200 From: Andrea Aime To: Oliver Jowett Subject: Re: Queries with large ResultSets Date: Fri, 21 May 2004 08:14:58 +0200 User-Agent: KMail/1.6.1 Cc: pgsql-jdbc@postgresql.org References: <40ABD19C.8080109@geophile.com> <200405202022.37646.andrea.aime@aliceposta.it> <40AD3733.5000905@opencloud.com> In-Reply-To: <40AD3733.5000905@opencloud.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200405210814.58303.andrea.aime@aliceposta.it> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/142 X-Sequence-Number: 10152 Alle 00:54, venerd=EC 21 maggio 2004, Oliver Jowett ha scritto: > Andrea Aime wrote: ... > I don't think you want a holdable cursor for this case anyway since the > backend would end up doing a lot of unnecessary copying results around. > If you're accessing big quantities of data, the overhead of an explicit > commit() after you're done with the resultset is going to be > insignificant compared to the cost of actually transferring and handling > that data. Use something like this: > > connection.setAutoCommit(false); > PreparedStatement stmt =3D connection.prepareStatement("SELECT ...."); > ResultSet rs =3D stmt.executeQuery(); > while (rs.next()) { > // process data > } > rs.close(); > connection.commit(); > > -O I see... well, that's what I will need to do it seems. Thank you for the=20 advice :-) Best regards Andrea Aime