Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id EF1896322C2 for ; Sun, 18 Apr 2010 00:48:26 -0300 (ADT) 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 61714-04 for ; Sun, 18 Apr 2010 03:48:16 +0000 (UTC) X-Greylist: delayed 01:00:13.920108 by SQLgrey-1.7.6 Received: from vms173005pub.verizon.net (vms173005pub.verizon.net [206.46.173.5]) by mail.postgresql.org (Postfix) with ESMTP id 891A96322B6 for ; Sun, 18 Apr 2010 00:48:16 -0300 (ADT) Received: from XP2 ([unknown] [151.201.139.26]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L1100AIEX3Q9GI1@vms173005.mailsrvcs.net> for pgsql-jdbc@postgresql.org; Sat, 17 Apr 2010 21:47:52 -0500 (CDT) Message-id: <0L1100AIUX3R9GI1@vms173005.mailsrvcs.net> From: "John T. Dow" To: "pgsql-jdbc@postgresql.org" Cc: "Oliver Jowett" Date: Sat, 17 Apr 2010 22:47:21 -0400 X-Mailer: PMMail 2000 Professional (2.20.2717) For Windows 2000 (5.1.2600;3) In-reply-to: <4B4F93A4.4060601@opencloud.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Subject: refreshRow is slow - revisited X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/27 X-Sequence-Number: 20438 Several months ago, on January 14, I posted a question about JDBC's refreshRow being slow. The problem is that the resultset code is accessing the server for each column. It needs to know the column names so it can build a query to get the values for that single row. It knows the position of the resultset columns in the actual table, but not the column names. Oliver Jowett suggested that a method like this might help because it would get all column names at once: static String[] Field.getColumnNames(Connection,Field[]) Having poked around in the code, I notice that not only refreshing rows but also updating column values suffers from this problem, namely a visit to the server for each column to be updated. I should think that the proper fix would be to get the names of all the columns when the resultset is created so that any number of updates and refreshes could be performed without accessing the server for names. In the meantime, since the names returned by the result set agree with the actual table names if there are no aliases in the original list of columns, I am about to try a small modification -- to use the column label (which is in memory) instead of the base column name (which isn't). It seems to work in the lab, haven't tried it in the real world yet. Question: should I expect something as simple as this to work, or am I overlooking something? John