What is the difference between optimistic and pessimistic locking?

Started by chinmay.sahoo, 02-27-2016, 04:27:18

Previous topic - Next topic

chinmay.sahooTopic starter

Pessimistic is used when the user want to lock the records so that no one can update data. The user are only allowed to view the data.
In optimistic multiple user can update an view the data


TomClarke

As for pessimistic locking: on updating the data, the record gets locked and no one else can access that record for updating. It becomes a read-only record till the lick is released. Once the lock gets released, the record can be locked again and get updated for a different user.
And optimistic locking: this allows multiple user to open up the same record for updating. Record gets locked only while updating the record. This is the most preffered way of locking for the web application.