Database · Medium
Differentiate between optimistic locking and pessimistic locking. When should you use each?
DatabaseTransactionsSenior
Answer preview
Both strategies protect a read-modify-write cycle from lost updates. Pessimistic locking prevents conflict by locking the row up front; optimistic locking allows the conflict to happen and detects it at write time using a version check.…