Dag H. Wanvik wrote:
Hi,
Andreas> > 2) Applications use the FOR UPDATE clause to control locking for
Andreas> > future updates with read only ResultSets.
Andreas> >
Andreas>
Andreas> Note currently it throws an exception if the statement is not updatable
Andreas> i.e contains a join or order by.
I guess what you mean here is that the FOR UPDATE is not in general
available as a means for locking for future updates.
To Dan's point, my tests indicate that the current Derby
implementation for forward-only updatable result sets only sets a row
update lock while on the current row.
In contrast, Oracle's "FOR UPDATE" places locks on the entire result
set for the duration of the transaction (see below). The usefulness as
a way to control locking would be more useful if the Derby locking was
closer to what Oracle does, at the expense of concurrency.
Dag
Just a little pick at the wording... What's "useful" behaviour depends
on the application and its needs. If you don't need update locks on the
entire result set, the "usefulness" of such a behaviour is negative,
since it only reduces concurrency and, as such, overall performance.
--
Oyvind Bakksjo
Sun Microsystems, Database Technology Group
Trondheim, Norway
http://weblogs.java.net/blog/bakksjo/