Re: refreshRow is slow

From: "John T(dot) Dow" <john(at)johntdow(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: refreshRow is slow
Date: 2010-01-16 03:08:44
Message-ID: 201001160309.o0G398sO050544@web2.nidhog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sat, 16 Jan 2010 14:23:33 +1300, Oliver Jowett wrote:

>John T. Dow wrote:
>
>> Certainly that piece of code can be made more efficient. One query ought to be able to return all the primary keys.
>
>It's not the PKs it is after (it's already worked those out earlier),
>it's the column names to select to populate the rest of the resultset.

I realized that when I looked more carefully at the code.

>But yes, it could be more efficient. We'd need a static String[]
>Field.getColumnNames(Connection,Field[]) method or similar.

That would be really nice.

Another approach is to reread the entire resultset, but with hundreds of rows that's not pretty. Probably faster than many round trips to get the column names. I could have my programming look at the size of the resultset and the number of columns and decide whether to execute the query again or refreshRow.

John

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jakub Bednář 2010-01-18 07:19:25 Mapping Java BigDecimal
Previous Message Oliver Jowett 2010-01-16 01:23:33 Re: refreshRow is slow