Count InnoDB Deadlocks

When running a transactional application you have to live with deadlocks. They are not problematic as long as they do not occur too frequently. The standard SHOW ENGINE INNODB STATUS gives information on the latest deadlocks but it is not very useful when you want to know the total number of deadlocks or the number of deadlocks per unit of time.

This change adds a status variable that keeps track of the number of deadlocks since the server startup, opening the way to a better knowledge of your deadlocks.

This feature was provided by Eric Bergen under BSD license (see InnoDB Deadlock Count Patch).

It adds a new global status variable (innodb_deadlocks) showing the number of deadlocks.*

You can use it with SHOW GLOBAL STATUS, e.g.:

mysql> SHOW GLOBAL STATUS LIKE 'innodb_deadlocks';
| Variable_name    | Value |
| innodb_deadlocks | 323   |


| 323            |

A deadlock will occur when at least two transactions are mutually waiting for the other to finish, thus creating a circular dependency that lasts until something breaks it. InnoDB is quite good at detecting deadlocks and generally returns an error instantly. Most transactional systems have no way to prevent deadlocks from occurring and must be designed to handle them, for instance by retrying the transaction that failed.

Version Specific Information

Status Variables

One new status variable was introduced by this feature.

variable Innodb_deadlocks
Variable Type:LONG
© Copyright Percona LLC and/or its affiliates 2009-2015.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.2.2.
This documentation is developed in Launchpad as part of the Percona Server source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.