29

有懂秒杀的兄弟吗?为什么 mysql 这样会出现超卖的问题

 5 years ago
source link: https://www.v2ex.com/t/509707
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Java - @cyhulk - 首先设定一个前提,为了防止超卖现象,所有减库存操作都需要进行一次减后检查,保证减完不能等于负数。(由于 MySQL 事务的特性,这种方法只能降低超卖的数量,但是不可能完全避免超卖)update

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK