当多个表被锁定时,DBA可以做什么?

时间:2013-02-19 22:13:38

标签: mysql

我有多个表locked,似乎他们阻止其他查询运行。什么可能导致这个问题,我该如何防止它?在释放这些locks的同时,我还能做些什么?我通读了mysql doc,但我真的不明白程序是什么来防止这个问题。

+----------+----------+--------+-------------+
| Database | Table    | In_use | Name_locked |
+----------+----------+--------+-------------+
| bd1      | table1   |      0 |           0 |
| bd1      | table2   |      5 |           0 |
| bd1      | table3   |      0 |           0 |
| bd1      | table4   |      1 |           0 |
| bd1      | table5   |      0 |           0 |
| bd1      | table6   |      2 |           0 |
| bd1      | table7   |      4 |           0 |
+----------+----------+--------+-------------+

SHOW ENGINE INNODB状态;

---TRANSACTION A7DF86B, ACTIVE 10 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 170083, OS thread handle 0x15a8, query id 1780479 23.20.117.233 Server2 Updating
UPDATE table7 SET EId = 'b457200', LEd = '2013-02-19 16:03:34', ELR = 'y', LU = '2013-02-19 16:03:
34' WHERE (ObKey = '79321fc7b5ac')

1 个答案:

答案 0 :(得分:0)

首先,您应该找到引用这些表的查询并了解它们的使用方式。其次,您可以尝试使用一些查询提示作为增加并发性的方法。见http://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html