Mysql Locks
Mysql 锁
Record Locks (记录锁)
事务 - 1
事务隔离级别 == REPEATABLE READ
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
UPDATE tt_order_item SET Deleted = 1, Version = Version + 1 WHERE OrderNumber = '17111803861711180386';
COMMIT
事务 - 2
事务隔离级别 == REPEATABLE READ
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
UPDATE tt_order_item SET Deleted = 0, Version = Version + 1 WHERE OrderNumber = '17111803861711180386';
COMMIT
事务 - 3
事务隔离级别 == READ COMMITTED
此事务隔离级别下,仅会读取到事务已提交后的变更结果
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT *
FROM tt_order_item
WHERE OrderNumber = 'IBRB17111803861711180386';
参考资料
最后修改于 2024-03-29
此篇文章的评论功能已经停用。