Pessimistic vs. Optimistic

Intro every day )

  1. Pessimistic Locking: This approach involves locking data as soon as it is accessed, assuming that conflicts will likely occur. It prevents other transactions from accessing or modifying the same data until the lock is released, reducing the chance of conflicts but potentially leading to lower concurrency and performance.

  2. Optimistic Locking: In contrast, this approach assumes that conflicts are rare, so it allows multiple transactions to access and modify the same data concurrently. Before committing changes, it checks if any other transactions have modified the data since it was last read. If conflicts are detected, it typically rolls back the transaction or takes appropriate action to resolve the conflict.

See

https://medium.com/@abhirup.acharya009/managing-concurrent-access-optimistic-locking-vs-pessimistic-locking-0f6a64294db7

Pessimistic vs. Optimistic Locking in MySQL - DEV Community

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

P("Struggler") ?

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值