试图理解这个特定的演讲幻灯片
问题:T1和T2的以下执行是否可序列化?
T1 T2
Begin transaction | | (1,1000) , (2,2000)
Select balance into :ybal | |
From Accounts | |
Where accountId = 2; | | ybal = 2000;
-----------------------------------------------------------------------------------
| |
| Begin transaction; |
| Select balance into xbal2; | xbal = 1000;
| From Accounts |
| Where accountId = 1; |
| |
-----------------------------------------------------------------------------------
| Select balance into ybal2; |
| From Accounts | ybal2 = 2000;
| Where accountId = 2; |
| |
-----------------------------------------------------------------------------------
Update Accounts | | (1,1000) , (2,2200)
Set balance = ybal + 200; | |
Where accountId = 2; | |
Commit; | |
-----------------------------------------------------------------------------------
| Update Accounts |
| Set balance = xbal2 + 100 | (1,1100) , (2,2200)
| Where accountId = 1; |
| Commit; |
答案是可序列化的
首先,我需要了解可序列化和非序列化交易之间的差异。两种交易类型的账户余额的最终状态如何?它们看起来一样吗?
如果有人可以将我的示例更改为不可序列化的示例,那么我可以看到它们之间的差异。
所以现在,我不明白的是确定它是否可序列化或不可序列化的过程。
任何人都可以帮助解释您自己确定是否可序列化的过程吗?
谢谢。