浏览主题:又來提問,關於鎖
主题:又來提問,關於鎖
|
第一個進程
begin transaction select * from a with(xlock,rowlock) where id=4 第二個進程 select * from a where id=4 此時,第一個進程事務尚未結束,並且,with(xlock,rowlock)代表行級排他鎖,为何第二個進程的語句仍可執行? 同時測試了一下 使用 with(xlock,tablock):表級排他鎖 和 with(xlock,paglock):頁級排他鎖 均可實現 奇怪的是 在第二個進程 我使用 select * from a with(repeatanleread) where id=4 就執行不了了 這就證明在這條紀錄上是有鎖的,因為repeatanleread表示跳過帶鎖的紀錄 |
|
期待中~~ 对锁一直很迷糊~。。~ |