A plain old "delete single record" statement froze on me. Suspecting a (dead)lock issue, I checked the process list to see what blocks the delete
. The delete
statement was the only running db process and still its state was Locked
. It remained in this state for something like 2 minutes and then finished successfully.
Question: what can make a MySQL process Locked
except another process holding a lock?
Below is the output from show processlist
:
mysql> show processlist;
+-------+------+-----------------------------------+------+---------+------+--------+---------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+------+-----------------------------------+------+---------+------+--------+---------------------------------------------+
| 79616 | htt | gateway1.xxxxxxxxxxxxxxxxxx:42254 | foo | Query | 106 | Locked | delete from xbarApp_testfoo where id = 2279 |
| 79618 | htt | gateway1.xxxxxxxxxxxxxxxxxx:41009 | foo | Query | 0 | NULL | show processlist |
+-------+------+-----------------------------------+------+---------+------+--------+---------------------------------------------+
2 rows in set (0.35 sec)