Home > Database > Mysql Tutorial > MySQL 运维笔记(一) 终止高负载SQL

MySQL 运维笔记(一) 终止高负载SQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:59:17
Original
1065 people have browsed it

数据库表体积大了,负载高了,难免一个sql出去耗时延长。半个月前,一个凌晨定时任务跑了8小时,突然手足无措。最后找DBA协助,直接干掉了这个sql进程。 其实,这并不复杂。 首先,找出占用CPU时间过长的SQL show processlist; - 假定最后一条sql处于Query状

数据库表体积大了,负载高了,难免一个sql出去耗时延长。半个月前,一个凌晨定时任务跑了8小时,突然手足无措。最后找DBA协助,直接干掉了这个sql进程。

其实,这并不复杂。

首先,找出占用CPU时间过长的SQL

show processlist; 


-


假定最后一条sql处于Query状态,且Time时间过长,就锁定它的ID,直接干掉即可。

然后,杀死进程:

kill QUERY  4487855; 

这就大功告成了!

参考
KILL [CONNECTION | QUERY] thread_id

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template