Thursday , April 25 2024

Optimistic and Pessimistic Concurrency Control

 

If you want to make a change in more than one session database at the same time, the control to prevent sessions from adversely affecting each other is called Concurrency Control.

To better understand Concurrency Control, you may want to read the article entitled “SQL Server Lock Types“.

There are two types of Concurrency Control:

Pessimistic Concurrency ControlIn the pessimistic pessimistic concurrency control, when a user wants to change a record, it puts a lock on the record and any other session can not change that record.

The first session changes the record, and then the lock on the record is opened. and others who want to change can now be changed.

Optimistic Concurrency ControlIn the optimistic concurrency control, It is assumed that a record at the same time will not be updated. and multiple sessions can be accessed to update the same record.

If the same record is updated by more than one person, one of the records is canceled and the user is informed that it is canceled.

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories