서로 다른 두 트랜잭션에서 동일한 로우를 업데이트하면 락이 발행해서
나중 세션이 대기 상태가 됩니다.
os 의 ps -ef 명령어로도 이를 관찰할수 있습니다.
아래 처럼 말이죠. 대신 block 당하는 놈만 알수 있고 blocker 는 누군지 알수 없습니다.
아래에서는 scott 유저로 접속한 세션이 단 2개라서
blocker pid => 1313
blockee pid => 1335 를 금방 알수 있겠네요.
[enterprisedb@TESTSERVER:/ppas]$ ps -ef|grep postgres|grep -v grep
...............
500 1313 3196 0 09:20 ? 00:00:00 postgres: scott testdb [local] idle in transaction
500 1335 3196 0 09:20 ? 00:00:00 postgres: scott testdb [local] UPDATE waiting
500 2764 3196 0 09:22 ? 00:00:00 postgres: appuser testdb 10.57.138.165[49336] idle
500 2765 3196 0 09:22 ? 00:00:00 postgres: appuser testdb 10.57.138.165[49337] idle
500 2766 3196 0 09:22 ? 00:00:00 postgres: appuser testdb 10.57.138.165[49338] idle