PostgreSQL - Transactions and Concurrency
Given two transactions:
What is the risk of deadlock if both transactions update each other's rows in reverse order?
-- Transaction 1
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
-- Transaction 2
BEGIN;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;What is the risk of deadlock if both transactions update each other's rows in reverse order?
