C > begin; > begin; > begin; > execute large DMLs 🐢 > execute large DMLs 🐢 > execute large DMLs 🐢 > update test set v = v + 1 where k = 1; > update test set v = v + 1 where k = 1; > update test set v = v + 1 where k = 1; > commit; > commit; ERROR 9007 (HY000): Write conflict, …, reason=Optimistic [try again later] > commit; ERROR 9007 (HY000): Write conflict, …, reason=Optimistic [try again later]
C > begin; > begin; > begin; > execute large DMLs 🐢 > execute large DMLs 🐢 > execute large DMLs 🐢 > update test set v = v + 1 where k = 1; -- lock k = 1 > update test set v = v + 1 where k = 1; -- lock k = 1, block > update test set v = v + 1 where k = 1; -- lock k = 1, block > commit; lock released, retry update test set v = v + 1 where k = 1; blocked > commit; lock released, retry update test set v = v + 1 where k = 1; Document: Pessimistic Lock Transaction