Re: Queries with large ResultSets - Mailing list pgsql-jdbc

From Andrea Aime
Subject Re: Queries with large ResultSets
Date
Msg-id 200405210814.58303.andrea.aime@aliceposta.it
Whole thread Raw
In response to Re: Queries with large ResultSets  (Oliver Jowett <oliver@opencloud.com>)
List 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


pgsql-jdbc by date:

Previous
From: henk53602@hotmail.com (henk53)
Date:
Subject: Replicating JDBC proxy
Next
From: Oliver Jowett
Date:
Subject: Re: Parsing problem when launching SQL files with Ant (through