Quick Answer
InnoDB's deadlock detector checks for deadlock cycles every second. When detected, it rolls back the transaction with the least amount of undo (typically the most recently started). The rolled-back transaction receives error 1213 (Deadlock found). The application must catch this error and retry the transaction. You can view the last deadlock with SHOW ENGINE INNODB STATUS.
Answer
InnoDB automatically identifies deadlocks and rolls back one transaction to allow others to proceed.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.