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 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2004-05-21 07:52:03 | Re: Parsing problem when launching SQL files with Ant (through |
Previous Message | Oliver Jowett | 2004-05-21 05:15:35 | Re: Driver JDBC3 build 213 for postgreSQL 7.4 |