如何停止正在运行的mysql查询 [英] How to stop a running mysql query

查看:3845
本文介绍了如何停止正在运行的mysql查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式停止正在运行的mysql查询?

How do I stop a running mysql query programmatically?

我面临的问题是查询是使用用户提供的数据构建的,有时可能需要很长时间才能执行(大表15到3000万行) )。我想为用户提供一个取消选项,但不知道如何停止当前正在执行的mysql查询。

The problem I'm facing is that a query is constructed using user supplied data, and may occasionally take a very long time to execute (large tables 15 - 30 million rows). I want to offer the user a cancel-option, but don't know how to stop the currently executing mysql-query.

该应用程序是一个Java applet-servlet:用户在applet中指定标准,该标准被传递给servlet,在servlet中创建处理程序类来处理请求。这个handler-class是自包含的re connect - query - disconnect to mysql。

The application is a Java applet-servlet: the user specify criteria in the applet which is passed to the servlet where a handler-class is created to handle the request. This handler-class is self-contained re connect - query - disconnect to mysql.

鉴于这种情况,如何取消正在运行的mysql查询?

Given this scenario, how do I cancel a running mysql-query?

推荐答案

SHOW PROCESSLIST;
KILL <thread_to_be_killed>;

有关其他详细信息,请参阅文档

Refer to the documentation for additional details

显示流程列表

杀死正在运行的主题

这篇关于如何停止正在运行的mysql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆