4. 例(Rails) Id money 1 400 User.transaction do user = User.lock.find_by(id: 1) user.money += 400 user.save! end BEGIN; SELECT * FROM users WHERE id = 1 FOR UPDATE; UPDATE users SET users.money = 800 WHERE id = 1; COMMIT; usersテーブル 悲観ロック 5. 例の問題 リクエスト リクエスト BEGIN; SELECT * FROM users WHERE id = 1 FOR UPDATE; UPDATE users SET users.money = 800 WHERE id = 1; COMMIT; BEGIN; SELECT * FROM users WHERE i