Bug #24831 Patch: KILL thread_id WITH QUERY query_id
Submitted: 5 Dec 2006 17:58 Modified: 15 Dec 2010 14:21
Reporter: Lenz Grimmer Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.0-community OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Needs Triage: D5 (Feature request)

[5 Dec 2006 17:58] Lenz Grimmer
Description:
This bug report is a placeholder to keep track of the progress of including this
patch from Joel Seligstein to display the uptime since the last FLUSH STATUS
command, available from http://jcole.us/patches/mysql/5.0/kill_with_query_id.patch

How to repeat:
Apply the patch

Suggested fix:
Apply the patch
[24 Mar 2010 14:52] Shannon Wade
Adding a similar feature request to be able to actually kill only if a specific query is still running. This bug seems most appropriate as the request is very similar to the patch functionality.

It's not possible to kill and restrict the kill to a specific query, only any query the connection is running at that time the kill is issued. Thus if you are running some script to kill long running queries it is possible that by the time you issue the kill that the connection has changed the statement that it is on. Specifically it would request to expose some type of query_id to the processlist and allow that as an additional argument to kill, if the query is still running when the kill is sent, kill it, or if not ignore.

From kill docs:

http://dev.mysql.com/doc/refman/5.1/en/kill.html

KILL allows the optional CONNECTION or QUERY modifier:

KILL CONNECTION is the same as KILL with no modifier: It terminates the connection associated with the given thread_id.

KILL QUERY terminates the statement that the connection is currently executing, but leaves the connection itself intact.