Skip site navigation (1) Skip section navigation (2)

refreshRow is slow - revisited

From: "John T(dot) Dow" <john(at)johntdow(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Cc: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Subject: refreshRow is slow - revisited
Date: 2010-04-18 02:47:21
Message-ID: 0L1100AIUX3R9GI1@vms173005.mailsrvcs.net (view raw or flat)
Thread:
Lists: 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 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


In response to

pgsql-jdbc by date

Next:From: John T. DowDate: 2010-04-19 03:05:32
Subject: refreshRow is slow - experimenting with modified version
Previous:From: Oliver JowettDate: 2010-04-16 21:34:38
Subject: Re: Are there any SQL or JDBC compliance suites use to test

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group