What can go wrong when two withdrawals hit the same account at once?
Two requests try to withdraw money from the same account at the same time. Each reads the balance with SELECT, subtracts the withdrawal amount in the application, and saves the result with UPDATE. What's wrong with this approach, and how can you make the withdrawals safe?
ExplainTransactions and locksMiddleBackend