BCA / B.Tech 5 min read

Concurrency Control

Concurrency Control Techniques in RDBMS:

Concurrency Control is the process of managing simultaneous operations on a database without having them interfere with one another. It ensures that database transactions are performed concurrently without violating the data integrity of the database.

Common Concurrency Control Techniques:
  • Lock-Based Protocols: This is the most common technique. It involves locking data items to prevent multiple transactions from accessing the same item concurrently in a conflicting way. Locks can be shared (for reading) or exclusive (for writing).
  • Timestamp-Based Protocols: This technique uses a unique timestamp for each transaction to determine the serializability order. If a transaction tries to access data that has been modified by a later transaction, it is rolled back.
  • Optimistic Concurrency Control: This method assumes that conflicts are rare and allows transactions to proceed without locking. Before a transaction commits, it checks if any of its read data has been modified by another transaction. If a conflict is found, the transaction is rolled back.
  • Multiversion Concurrency Control (MVCC): Instead of overwriting old data, this technique creates a new version of a data item when it is modified. Each transaction sees a consistent snapshot of the database, which improves performance for read-heavy workloads.