What is Pessimistic Concurrency?

Pessimistic, or negative, concurrency control is when a record is locked at the time the user begins his or her edit process.  In this concurrency mode, the record remains locked for the duration of the edit.  The primary advantage is that no other user is able to get a lock on the record for updating, effectively informing any requesting user that they cannot update the record because it is in use.

There are several drawbacks to pessimistic concurrency control.  If the user goes for a coffee break, the record remains locked, denying anyone else the ability to update the record, even if it has been untouched by the initial requestor.  Also, in order to maintain record locks, a persistent connection to the database server is required.  Since web applications can have hundreds or thousands of simultaneous users, a persistent connection to the database cannot be maintained without having tremendous resources on the database server.  Moreover, some database tools are licensed based on the number of concurrent connections.  As such, applications that use pessimistic concurrency would require additional licenses for use.  Because of this drawback, almost all applications use optimistic concurrency control.

See Also

Concurrency Control