数据库减库存的索引问题
来源:7-4 活动缓存库存方案一

BoxboxMan
2019-05-30
update item_stock set stock = stock - #{amount} where item_id = #{item_Id} and stock >= #{amount}
老师,我认为这个地方即使我们加上了 item_stock这个unique index依旧在这条sql中无法触发索引进行查询。
写回答
1回答
-
应该是在item id上加唯一索引吧 不能触达的原因是?
122019-05-30
相似问题