// mysql · sql behavior

innodb_deadlock_detect

Detect deadlocks immediately and roll back one of the transactions.

Par défaut
ON
Range
ON, OFF
Restart needed
Non
Default checked on
MySQL 8.4 LTS

Ce que cela fait

With detection off, deadlocked transactions wait until innodb_lock_wait_timeout. Detection itself can become a bottleneck when hundreds of threads wait on the same rows.

Valeur par défaut

ON. ON (MySQL 8.4).

Check the current value

SHOW GLOBAL VARIABLES LIKE 'innodb_deadlock_detect';

SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME
FROM performance_schema.variables_info
WHERE VARIABLE_NAME = 'innodb_deadlock_detect';

Change it

SET GLOBAL innodb_deadlock_detect = OFF;    -- until the next restart
SET PERSIST innodb_deadlock_detect = OFF;   -- now and after restarts

No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.

When to change it

Only on very high-concurrency systems where profiling shows deadlock detection as the bottleneck, together with a low innodb_lock_wait_timeout.

What can go wrong

Off, real deadlocks last for the full lock wait timeout.

Questions about innodb_deadlock_detect

What is the default value of innodb_deadlock_detect in MySQL?

ON. ON (MySQL 8.4).

Does changing innodb_deadlock_detect require a restart?

No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.

When should I change innodb_deadlock_detect?

Only on very high-concurrency systems where profiling shows deadlock detection as the bottleneck, together with a low innodb_lock_wait_timeout.

Back to all MySQL settings, or check the MySQL manual for every option.

// one client for every engine

Check innodb_deadlock_detect on your own server

SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.