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

Re: Queries with large ResultSets

From: Andrea Aime <andrea(dot)aime(at)aliceposta(dot)it>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Queries with large ResultSets
Date: 2004-05-21 06:14:58
Message-ID: 200405210814.58303.andrea.aime@aliceposta.it (view raw or flat)
Thread:
Lists: pgsql-jdbc
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


In response to

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2004-05-21 07:52:03
Subject: Re: Parsing problem when launching SQL files with Ant (through
Previous:From: Oliver JowettDate: 2004-05-21 05:15:35
Subject: Re: Driver JDBC3 build 213 for postgreSQL 7.4

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