← Advanced DBMS learning path
Advanced DBMS · Module 5 of 10

Concurrency control

Manage simultaneous transactions safely.

📖 Key ideas

  1. Problems: lost update, dirty read, non-repeatable read, phantom read.
  2. Locking: shared (read) and exclusive (write) locks.
  3. Two-Phase Locking (2PL) guarantees serializability.
  4. Timestamp ordering and MVCC are alternatives.
  5. SQL isolation levels: Read Uncommitted, Read Committed, Repeatable Read, Serializable.
💡 Real-life example: Locks are bathroom door signs: occupied (exclusive) or "you may peek" (shared).
Shared lockAllows concurrent reads
Exclusive lockRequired to write
2PLTwo-Phase Locking protocol
MVCCMulti-Version Concurrency Control