Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* アドバイザリーロック [#le1b8fe2]
** 排他勧告的ロック pg_try_advisory_xact_lock [#l82d35ce]
Session A │ Session B
========================================================...
=> BEGIN; UPDATE t1 SET n = 101 WHERE id = 1 R│=>
ETURNING pg_try_advisory_xact_lock(id); │=>
BEGIN │=>
pg_try_advisory_xact_lock │=>
--------------------------- │=>
t │=>
(1 row) │=>
│=>
=*> │=> BEGIN;...
│try_advis...
│BEGIN
│ id | n
│----+---
│(0 rows)
│
│=*>
=*> COMMIT; │=*>
=> │=*> SELEC...
=> │visory_xa...
│ id | n
│----+-----
│ 1 | 101
│(1 row)
│
│=*>
** 参考 [#yd5f4ce2]
- https://www.postgresql.org/docs/current/explicit-lockin...
- https://www.postgresql.jp/document/12/html/functions-ad...
- https://www.programmersought.com/article/48592944017/
- https://subscription.packtpub.com/book/data/97817895378...
- https://tech.gunosy.io/entry/digdag-operator-pg_lock#pg...
終了行:
* アドバイザリーロック [#le1b8fe2]
** 排他勧告的ロック pg_try_advisory_xact_lock [#l82d35ce]
Session A │ Session B
========================================================...
=> BEGIN; UPDATE t1 SET n = 101 WHERE id = 1 R│=>
ETURNING pg_try_advisory_xact_lock(id); │=>
BEGIN │=>
pg_try_advisory_xact_lock │=>
--------------------------- │=>
t │=>
(1 row) │=>
│=>
=*> │=> BEGIN;...
│try_advis...
│BEGIN
│ id | n
│----+---
│(0 rows)
│
│=*>
=*> COMMIT; │=*>
=> │=*> SELEC...
=> │visory_xa...
│ id | n
│----+-----
│ 1 | 101
│(1 row)
│
│=*>
** 参考 [#yd5f4ce2]
- https://www.postgresql.org/docs/current/explicit-lockin...
- https://www.postgresql.jp/document/12/html/functions-ad...
- https://www.programmersought.com/article/48592944017/
- https://subscription.packtpub.com/book/data/97817895378...
- https://tech.gunosy.io/entry/digdag-operator-pg_lock#pg...
ページ名: