Advanced SQL
Q92 / 100

What is the difference between "optimistic locking" and "pessimistic locking" concurrency control strategies?

Correct! Well done.

Incorrect.

The correct answer is B) Pessimistic locking acquires locks upfront to block other transactions, while optimistic locking allows concurrent access and checks for conflicts (e.g. via a version column) only at commit time, failing if one is detected

B

Correct Answer

Pessimistic locking acquires locks upfront to block other transactions, while optimistic locking allows concurrent access and checks for conflicts (e.g. via a version column) only at commit time, failing if one is detected

Explanation

Pessimistic locking trades concurrency for safety by locking resources before use; optimistic locking assumes conflicts are rare, allowing concurrent reads/writes but validating (often via a version/timestamp column) before committing, rejecting the transaction if the data changed underneath it.

Progress
92/100