ποΈ 07082025 1051
π
optimistic_locking
βAssume no conflict. Check at the end.β
π§° Mechanism:β
- Allow multiple transactions to proceed in parallel
- Use versioning or timestamps
- At commit, verify no one else changed the data
π’ Pros:β
- Better concurrency
- No blocking β more performant under low contention
π΄ Cons:β
- Can fail often under high contention
- Requires conflict detection + retry logic
π οΈ Common in:β
- ORMs (e.g., JPA
@Version
) - Web apps / distributed systems
References
- ChatGPT