一个普通的“删除单个记录”语句冻结了。怀疑是(死)锁问题,我检查了进程列表以查看是什么阻塞了delete
。该delete
语句是唯一正在运行的数据库进程,其状态仍然是Locked
。它保持这种状态大约 2 分钟,然后成功完成。
Locked
问题:除了另一个持有锁的进程之外,什么可以使 MySQL 进程停止?
以下是的输出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)