I have a question about pessimistic versus optimistic locking. Everybody says that "Optimistic locking is used when you don't expect many collisions.", for example:
- which concurrency control is more efficient pessimistic or optimistic concurrency control
- Optimistic vs. Pessimistic locking
For a school project I need to find the 'break-even' point when pessimistic locking is more appropriate then optimistic locking.
Now, I would like to know/understand why such a break-even point exists? How it is possible that pessimistic locking is more costly (in speed or memory usage?) then optimistic locking?
I suspect it is because of the extra read-operation that pessimistic locking requires. But with optimistic locking this extra read-operation is also needed (only just before the save operation), right?
Hopefully someone can explain this :) Thank you!