* 通过创建存储过程来执行

CREATE PROCEDURE `kill_long_query_limit`(IN limit_num int)
COMMENT '获得长时间未结束的查询'
BEGIN
SET @sqlcmd1 = CONCAT("SELECT * FROM information_schema.`PROCESSLIST` WHERE id <> CONNECTION_ID() ORDER BY time DESC LIMIT ",limit_num,";");
PREPARE stmt1 FROM @sqlcmd1;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
END;

点赞(0) 打赏

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部