Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 16F326355AB for ; Fri, 15 Jan 2010 23:14:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60173-02-2 for ; Sat, 16 Jan 2010 03:13:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from web2.nidhog.com (web2.nidhog.com [66.207.132.3]) by mail.postgresql.org (Postfix) with ESMTP id 548C2634729 for ; Fri, 15 Jan 2010 23:10:05 -0400 (AST) Received: from XP2 (pool-71-253-4-223.pitbpa.east.verizon.net [71.253.4.223]) (authenticated bits=0) by web2.nidhog.com (8.14.3/8.13.8) with ESMTP id o0G398sO050544; Fri, 15 Jan 2010 22:09:10 -0500 (EST) (envelope-from john@johntdow.com) Message-Id: <201001160309.o0G398sO050544@web2.nidhog.com> From: "John T. Dow" To: "Oliver Jowett" Cc: "pgsql-jdbc@postgresql.org" Date: Fri, 15 Jan 2010 22:08:44 -0500 X-Mailer: PMMail 2000 Professional (2.20.2717) For Windows 2000 (5.1.2600;3) In-Reply-To: <4B511515.6090809@opencloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: refreshRow is slow X-Nidhog-MailScanner-Information: Please contact the ISP for more information X-Nidhog-MailScanner: Found to be clean X-Nidhog-MailScanner-From: john@johntdow.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/35 X-Sequence-Number: 20231 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