What is a deadlock, and how can you prevent one?
Two transactions update the same rows in different orders, and neither can make progress. How can you tell whether a deadlock has occurred? What will the DBMS do, and how can you change the code to reduce the risk of deadlocks?
ExplainTransactions and locksJuniorBackendData Engineer