Re: refreshRow is slow

From: "John T(dot) Dow" <john(at)johntdow(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: refreshRow is slow
Date: 2010-01-20 14:07:58
Message-ID: 201001201408.o0KE87vp082207@web2.nidhog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Having decided that refreshRow is going to be too slow sometimes (because it does a query for each column to see if it's a primary key), I am for the time being revising my standard application logic to execute the original query again.

A small complication has developed. There is no guarantee that the rows will be returned in the same order, unless the order is explicitly stated in the query. Since my queries are usually user-defined (that is, generated by the application based on user requests in a non-SQL syntax), I'll have to do something like sort on the primary keys in all cases. Not necessarily a bad thing to do I suppose.

But another complication might be confusing to the users. Suppose someone else has added a row. Executing the original query brings up more rows than originally. If the user has been scrolling back and forth through the result set, suddenly a new row will appear. Also possible, someone deletes a row, so it disappears. That is likely to generate a phone call to me ("What happened?").

It sure would be nice if refreshRow was more efficient in learning which are the primary keys.

John

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Satish Burnwal (sburnwal) 2010-01-21 07:39:51 How to use JDBC to update LargeObject
Previous Message Donald Fraser 2010-01-20 10:02:19 Re: Mapping Java BigDecimal