pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrea Aime <andrea.aime@aliceposta.it>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Queries with large ResultSets
Date: Fri, 21 May 2004 08:14:58 +0200
Message-ID: <200405210814.58303.andrea.aime@aliceposta.it> (raw)
In-Reply-To: <40AD3733.5000905@opencloud.com>
References: <40ABD19C.8080109@geophile.com>
	<200405202022.37646.andrea.aime@aliceposta.it>
	<40AD3733.5000905@opencloud.com>

Alle 00:54, venerdì 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 = connection.prepareStatement("SELECT ....");
>    ResultSet rs = 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 
advice :-)

Best regards
Andrea Aime




view thread (13+ messages)  latest in thread

Message-ID: <200405210814.58303.andrea.aime@aliceposta.it>
Permalink:  ../200405210814.58303.andrea.aime@aliceposta.it/
Also on:    postgresql.org/message-id/200405210814.58303.andrea.aime@aliceposta.it

 · 

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: andrea.aime@aliceposta.it, oliver@opencloud.com
  Subject: Re: Queries with large ResultSets
  In-Reply-To: <200405210814.58303.andrea.aime@aliceposta.it>
  References: <40ABD19C.8080109@geophile.com> <200405202022.37646.andrea.aime@aliceposta.it> <40AD3733.5000905@opencloud.com> <200405210814.58303.andrea.aime@aliceposta.it>

* 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