From: John T. Dow <john@johntdow.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Cc: Oliver Jowett <oliver@opencloud.com>
Subject: refreshRow is slow - revisited
Date: Sat, 17 Apr 2010 22:47:21 -0400
Message-ID: <0L1100AIUX3R9GI1@vms173005.mailsrvcs.net> (raw)
In-Reply-To: <4B4F93A4.4060601@opencloud.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: john@johntdow.com, oliver@opencloud.com
Subject: Re: refreshRow is slow - revisited
In-Reply-To: <0L1100AIUX3R9GI1@vms173005.mailsrvcs.net>
References: <4B4F93A4.4060601@opencloud.com> <0L1100AIUX3R9GI1@vms173005.mailsrvcs.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox