Skip to content
ohsudo, Home

Tags

#transactions

deadlock detected
Databases

PostgreSQL "deadlock detected": read the message, then lock in the same order

Fix PostgreSQL "ERROR: deadlock detected": read which processes and rows were involved, lock rows in a consistent order, and retry on SQLSTATE 40P01.

Intermediate · 4 min read

Deadlock found
Databases

MySQL "Deadlock found when trying to get lock": read the report, retry, and stop the cycle

Fix MySQL error 1213 "Deadlock found when trying to get lock": read SHOW ENGINE INNODB STATUS, retry the transaction, lock rows in the same order and add missing indexes.

Intermediate · 4 min read