refreshRow is slow - revisited - Mailing list pgsql-jdbc

From John T. Dow
Subject refreshRow is slow - revisited
Date
Msg-id 0L1100AIUX3R9GI1@vms173005.mailsrvcs.net
Whole thread Raw
In response to Re: refreshRow is slow  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
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
canbuild 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
thata 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
thisproblem, 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
anynumber 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
inthe original list of columns, I am about to try a small modification -- to use the column label (which is in memory)
insteadof 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


pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Are there any SQL or JDBC compliance suites use to test
Next
From: "John T. Dow"
Date:
Subject: refreshRow is slow - experimenting with modified version