refreshRow is slow

From: "John T(dot) Dow" <john(at)johntdow(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: refreshRow is slow
Date: 2010-01-14 15:02:03
Message-ID: 201001141502.o0EF2Ix3083876@web2.nidhog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I am having no luck getting responses to a question I posted earlier about optimistic locking with multiple rows.

I'll ask a more targeted question. How do I efficiently refresh a single row in a resultset?

Suppose I allow users to view multiple records with TYPE_SCROLL_INSENSITIVE, CONCUR_READ_ONLY.

The user might select one row or 1,000 rows and scroll back and forth at will.

The user might choose to change one of the rows. I do this with a separate FOR UPDATE query.

The update query will fetch the current row, which might be different from the row in the original resultset. My programming compares the two rows and can report to the user the differences. After the row has been updated, I need to refresh that row in the result set so that if the user continues to scroll back and forth, it will see the updated information.

I am using refreshRow. I do setFetchSize(1) first. This works, but sometimes it is very slow. It can take many seconds over a remote connection. Can I fix that? What's going on?

Note: I don't want to use TYPE_SCROLL_SENSITIVE because it would update the row in the result set silently and I wouldn't be able to tell the user that somebody had changed anything. (Besides, I understand that TYPE_SCROLL_SENSITIVE doesn't work reliably.)

Thanks

John

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2010-01-14 21:59:00 Re: refreshRow is slow
Previous Message Oliver Jowett 2010-01-14 09:51:47 Re: JDBC CharSet with SQL_ASCII