dbTalk Databases Forums  

How do DBMS handle optimistic locking?

comp.databases comp.databases


Discuss How do DBMS handle optimistic locking? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gilles Ganault
 
Posts: n/a

Default How do DBMS handle optimistic locking? - 07-28-2007 , 06:03 PM






Hello,

I was wondering: How do server-based DBMS (PostgreSQL, Oracle,
etc.) handle concurrent updates with optimistic locking?

Say user A sends a SELECT over the LAN to the server to grab an
employee's personal details, and feed them to a grid object on the
client. While he's making changes to it, user B is also making changes
to the same employee, and sends his update while User A is still
working.

When user A sends his updates... the DBMS server will generate an
error, and ask user A to choose which changes to keep: His or User
B's.

How do DBMS's handle this? Do they use some kind of ticket to keep
track of what state the table was in when user A sent his SELECT, and
when the client wants to perform an UPDATE, the DBMS compares this
ticket to the local ticket, and sends an error if they don't match?

Thank you.

Reply With Quote
  #2  
Old   
HansF
 
Posts: n/a

Default Re: How do DBMS handle optimistic locking? - 07-28-2007 , 07:24 PM






On Jul 28, 5:03 pm, Gilles Ganault <nos... (AT) nospam (DOT) com> wrote:
Quote:
Hello,

I was wondering: How do server-based DBMS (PostgreSQL, Oracle,
etc.) handle concurrent updates with optimistic locking?

Say user A sends a SELECT over the LAN to the server to grab an
employee's personal details, and feed them to a grid object on the
client. While he's making changes to it, user B is also making changes
to the same employee, and sends his update while User A is still
working.

When user A sends his updates... the DBMS server will generate an
error, and ask user A to choose which changes to keep: His or User
B's.

How do DBMS's handle this? Do they use some kind of ticket to keep
track of what state the table was in when user A sent his SELECT, and
when the client wants to perform an UPDATE, the DBMS compares this
ticket to the local ticket, and sends an error if they don't match?

Thank you.
This is one of those things that vendors are allowed to implement
differently. And because the do, it is one of those things than makes
porting between RDBMSs a challenge.

Oracle's model is described here:
http://download.oracle.com/docs/cd/B...ist.htm#i13945
In Oracle, if the developer want to use pessimistic locking, [s]he can
use the 'FOR UPDATE' clause of the select statement to reserve the row
during the read.



Reply With Quote
  #3  
Old   
Gilles Ganault
 
Posts: n/a

Default Re: How do DBMS handle optimistic locking? - 07-29-2007 , 11:05 PM



On Sun, 29 Jul 2007 07:36:57 -0700, -CELKO- <jcelko212 (AT) earthlink (DOT) net>
wrote:
(snip)

Thanks guys for the pointers.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.