What is the difference between optimistic and pessimistic locking in databases?
-
A
Optimistic locking prevents all concurrent reads; pessimistic locking allows them
-
B
Optimistic locking assumes conflicts are rare and checks at commit time; pessimistic locking locks records upfront
-
C
Optimistic locking is used only in NoSQL; pessimistic locking only in SQL
-
D
They are different names for the same mechanism