mysql死锁后重启.但是命令一直在执行.

27 views
Skip to first unread message

foxbin

unread,
Feb 16, 2011, 1:49:42 PM2/16/11
to [MySQL中文用户群]
------------------------
LATEST DETECTED DEADLOCK
------------------------

*** (2) TRANSACTION:
TRANSACTION 0 1829811506, ACTIVE 2846 sec, process no 23099, OS thread
id 1183709504 fetching rows, thread declared inside InnoDB 79
mysql tables in use 1, locked 1
39659 lock struct(s), heap size 3848176, undo log entries 2530785
MySQL thread id 30117358, query id 176461999 221.192.134.7 joycdn
updating
delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
inserttime

delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
inserttime
请教一下,这个语句以前就执行过一次产生了死锁.后来每次重启数据库解决死锁的时候.过个两天又会出现这条语句导致的死锁.请问有没有办法解决.这个语
句以前只运行过一次.重启数据库后他还是会继续执行.有没有办法取消他?非常感谢.

老莫

unread,
Feb 16, 2011, 7:56:01 PM2/16/11
to imy...@googlegroups.com
�������һ������ɾ���������޴�,������������ڲ�ѯ�Ż�����,��취�Ż���
�ű�Ӧ�ÿ��Խ������.
�� 2011-2-17 2:49, foxbin �:

> ------------------------
> LATEST DETECTED DEADLOCK
> ------------------------
>
> *** (2) TRANSACTION:
> TRANSACTION 0 1829811506, ACTIVE 2846 sec, process no 23099, OS thread
> id 1183709504 fetching rows, thread declared inside InnoDB 79
> mysql tables in use 1, locked 1
> 39659 lock struct(s), heap size 3848176, undo log entries 2530785
> MySQL thread id 30117358, query id 176461999 221.192.134.7 joycdn
> updating
> delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
> inserttime
>
> delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
> inserttime
> ���һ��,��������ǰ��ִ�й�һ�β���������.����ÿ��������ݿ��������ʱ��.��������ֻ����������䵼�µ�����.������û�а취���.�����
> ����ǰֻ���й�һ��.������ݿ�����ǻ����ִ��.��û�а취ȡ����?�dz���л.
>

yuwenbao liu

unread,
Feb 17, 2011, 12:18:55 AM2/17/11
to imy...@googlegroups.com
可以限制执行这条语句的用户的对tmp表的权限
可以考虑加大你的innodb的buffer

另外如果这条语句是mysql自己执行的,看看是不是job里写了定时执行了

2011/2/17 老莫 <my.t...@gmail.com>
造成死锁一般是你删除的数据量巨大,而又有许多人在查询才会这样,想办法优化这
张表应该可以解决问题.

于 2011-2-17 2:49, foxbin 写道:
> ------------------------
> LATEST DETECTED DEADLOCK
> ------------------------
>
> *** (2) TRANSACTION:
> TRANSACTION 0 1829811506, ACTIVE 2846 sec, process no 23099, OS thread
> id 1183709504 fetching rows, thread declared inside InnoDB 79
> mysql tables in use 1, locked 1
> 39659 lock struct(s), heap size 3848176, undo log entries 2530785
> MySQL thread id 30117358, query id 176461999 221.192.134.7 joycdn
> updating
> delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
> inserttime
>
> delete from tmp where DATE_SUB(CURDATE(), INTERVAL 1 DAY) >=
> inserttime
> 请教一下,这个语句以前就执行过一次产生了死锁.后来每次重启数据库解决死锁的时候.过个两天又会出现这条语句导致的死锁.请问有没有办法解决.这个语
> 句以前只运行过一次.重启数据库后他还是会继续执行.有没有办法取消他?非常感谢.
>

--
您收到此邮件是因为您订阅了 Google 网上论坛的“[MySQL中文用户群]”论坛。
要向此网上论坛发帖,请发送电子邮件至 imy...@googlegroups.com
要取消订阅此网上论坛,请发送电子邮件至 imysql+un...@googlegroups.com
若有更多问题,请通过 http://groups.google.com/group/imysql?hl=zh-CN 访问此网上论坛。


Reply all
Reply to author
Forward
0 new messages