Intermediate
System Design
Q56 / 100
What is the difference between "pessimistic locking" and "optimistic locking" in databases?
Correct! Well done.
Incorrect.
The correct answer is A) Pessimistic locking locks a resource before reading/modifying it to prevent conflicts; optimistic locking allows concurrent access and checks for conflicts (e.g., via a version number) before committing
A
Correct Answer
Pessimistic locking locks a resource before reading/modifying it to prevent conflicts; optimistic locking allows concurrent access and checks for conflicts (e.g., via a version number) before committing
Explanation
Pessimistic locking avoids conflicts by blocking other transactions but can reduce concurrency; optimistic locking allows higher concurrency by detecting conflicts at commit time (e.g., using a version/timestamp column) and retrying if needed.
Progress
56/100