Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 写写冲突存在的意义
I would like to ask the teachers, what is the significance of write-write conflicts in the optimistic transaction model?
For example, one significance is that if transaction A wants to modify data that has not yet been committed, and it has already been modified by another transaction, then transaction A cannot proceed. Are there any other significances of write-write conflicts?
Optimistic transactions assume there will be no conflicts and check at the time of submission.
This approach is fast. There’s no need to lock in advance.
Choosing between the optimistic transaction model and the pessimistic transaction model mainly depends on business adaptation. If there are fewer transaction conflicts in the business, it is better to choose the optimistic transaction model to improve concurrency. Conversely, if there are more conflicts, it is better to choose the pessimistic transaction model to avoid transaction failures and retries caused by a large number of conflicts.