Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Best database for web backend on Linux?
In article <70oiem$phd$1_at_news.bctel.net>, "Thor" <thor_at_echidna.net> writes:
>we're still talking at cross purposes here.
>if we're using "browse-mode" as the starting point ....
>
>The Optimistic Locking is:
>
>t1. Read
>t2. Re-Read with Lock
>t3. Update
>t4. Commit / Rollback
>
I'm sorry, but this is not optimistic concurrency (or "browse mode"). Optimistic concurrency is essentially lock-free. So there is no "re-read".
The process is:
t1. Read t2. Update
The update may succeed or fail, depending upon whether the data has been changed between t1 and t2. This is determined (in Sybase) via a serial that is updated (automatically) each time a row is written.
[This can be done "by hand" as well, by adding to the UPDATE's WHERE clause a statement like "rowBeingUpdated.serial = @whatTheSerialWasBefore" and then checking the row count.]
>You lock once you know the user wants to modify that record, not just when
>they are viewing it.
>
This is not correct. What you describe is how to handle "very long operations" (ie. in a data browser) with locking. Optimistic concurrency exists as an alternative to your solution.