I have read many articles on when to use Optimistic vs. Pessimistic locking and my basic understanding is :
- Optimistic locking is more scalable so probably use this if possible
- Use pessimistic locking when it does not ever make sense to allow concurrent updates
I haven't been able to find any useful examples of when it would be smart to choose pessimistic locking (it seems that optimistic is usually preferred).
Would be very helpful if someone could answer for a specific example: say we have a Credit Card/account table and we want to authorize a transaction. Integrity is very important and I don't see why it would ever be useful to allow concurrent updates. Is this an example where we would use pessimistic locking?