Pessimistic Locking
Updated 2026-07-28
Summary
In relational database management systems, pessimistic concurrency control (also known as "pessimistic locking", abbreviated as "PCC") is a method of concurrency control. It prevents a transaction from modifying data in a way that affects other users. If a transaction's operation reads a row of data and applies a lock, other transactions cannot perform operations that conflict with that lock until the transaction releases it.
Definition
In relational database management systems, pessimistic concurrency control (also known as "pessimistic locking", abbreviated as "PCC") is a method of concurrency control. It prevents a transaction from modifying data in a way that affects other users. If a transaction's operation reads a row of data and applies a lock, other transactions cannot perform operations that conflict with that lock until the transaction releases it. Pessimistic concurrency control is mainly used in environments with intense data contention, and where the cost of protecting data with locks when concurrent conflicts occur is lower than the cost of rolling back transactions.
Introduction
How to use
In relational database management systems, pessimistic concurrency control (also known as "pessimistic locking", abbreviated as "PCC") is a method of concurrency control. It prevents a transaction from modifying data in a way that affects other users. If a transaction's operation reads a row of data and applies a lock, other transactions cannot perform operations that conflict with that lock until the transaction releases it.
Mechanism
Concurrency control strategy: lock before modifying data, assuming conflicts 'will happen', preventing others from writing simultaneously. The mechanism is to trade serialization for consistency, at the cost of reduced concurrency.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- High-consistency scenarios like bank deductions use pessimistic locking to prevent overselling.
Common pitfalls
- Indiscriminately adding locks regardless of scenario leads to performance bottlenecks; long transactions holding locks cause blocking and deadlocks.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E6%82%B2%E8%A7%82%E5%B9%B6%E5%8F%91%E6%8E%A7%E5%88%B6verified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS