Databases

Optimistic Concurrency

Posted on

Locking pessimistically a record in database could be a solution at times but mostly is itself a problem In the multiuser environment we often have to lock some data for a single user and make sure no other user accesses and changes that data at the same time. Such situations may arise when same record (a row in a table) is accessed by more than one users to make changes because the second user may end up over writing the changes of the first user. Let’s consider the following example From an online order receiving queue, different sales person can pick an order for processing. When an order is received its status is New. A sales person reviews an order using a Review form within our app, marks its status as processing, adds some comments and Saves it. The order is assigned to that sales person. Let say an order […]