postgres deadlock detected between two transactions
Postgres 15. Under load we see:
ERROR: deadlock detected
Detail: Process 1234 waits for ShareLock on transaction 5678; blocked by process 5678.
Process 5678 waits for ShareLock on transaction 1234; blocked by process 1234.
Hint: See server log for query details.
Two transactions updating the same rows in different order. Besides retrying, how do we actually prevent this? I am probably missing something obvious here.
4 replies