Concurrency Control
Process of managing simultaneous execution of transactions in a shared database, is known as concurrency control. Basically, concurrency control ensures that correct results for concurrent operations are generated, while getting those results as quickly as possible.
Need of Concurrency Control
Simultaneous execution of transactions over a shared database can create several data integrity and consistency problems.
Lost Update
This problem occurs when two transactions that access the same value items, have their operations interleaved in a way that makes the value of some database item incorrect.
Dirty Read Problems
The problem occurs when one transaction reads changes the value while the other reads the value before committing or rolling back by the first transaction.
Inconsistent Retrievals
.This problem occurs whorl a transaction accesses data before and after another transaction(s) finish working with such data
We need concurrence control, when
- The amount of data is sufficiently great that at any time only fraction of the data can be in primary memory and rest should be swapped from secondary memory as needed. n
- Even if the entire database can be present in primary memory, theere may be multiple processes.
Key Points–
- A failure in concurrency control can result in data corruption from torn read or write operations.
- DBMS need to deal also with concurrency control issues not typical just to database transactions but rather to operating systems in general.
- Concurrency control is an essential element for correctness in any system, where two database transactions or more, executed with time overlap, can access the same data, g., virtually in any general purpose database system.