Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* 行ロック - FOR SHARE [#k80128fb]
Sesseion A | Session B ...
========================================================...
=> BEGIN; SELECT * FROM t1 WHER | => ...
E id = 1 FOR SHARE; | => ...
id | n | => ...
----+----- | => ...
1 | 100 | => ...
| => ...
=*> | => BEGIN; SELECT * FR...
| E id = 1 FOR SHARE; ...
| id | n ...
| ----+----- ...
| 1 | 100 ...
| ...
| ...
| ...
| =*> UPDATE t1 SET n =...
| d = 1; ...
| ...
| ...
| ...
- FOR UPDATEを緩くしたのがFOR SHARE
- FOR UPDATEはあるトランザクションで行ロックされると、別...
- FOR SHAREはSELECTだけなら別のトランザクションからブロッ...
** 参考 [#v2895eda]
http://shiroyasha.io/selecting-for-share-and-update-in-po...
終了行:
* 行ロック - FOR SHARE [#k80128fb]
Sesseion A | Session B ...
========================================================...
=> BEGIN; SELECT * FROM t1 WHER | => ...
E id = 1 FOR SHARE; | => ...
id | n | => ...
----+----- | => ...
1 | 100 | => ...
| => ...
=*> | => BEGIN; SELECT * FR...
| E id = 1 FOR SHARE; ...
| id | n ...
| ----+----- ...
| 1 | 100 ...
| ...
| ...
| ...
| =*> UPDATE t1 SET n =...
| d = 1; ...
| ...
| ...
| ...
- FOR UPDATEを緩くしたのがFOR SHARE
- FOR UPDATEはあるトランザクションで行ロックされると、別...
- FOR SHAREはSELECTだけなら別のトランザクションからブロッ...
** 参考 [#v2895eda]
http://shiroyasha.io/selecting-for-share-and-update-in-po...
ページ名: