Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The official documentation defines the KILL QUERY statement as:
KILL QUERY terminates the statement that the connection thread_id is currently executing, but leaves the connection itself intact.
|
and defines DO like:
DO executes the expressions but does not return any results. In most respects, DO is shorthand for SELECT expr, ...,
|
but has the advantage that it is slightly faster when you do not care about the result.
|
Based on the documentation above, which doesn't defines what exactly is an statement, I would expect that at least both SELECT and DO are (or not) a statement (i.e both are treated the same way). But when executing something like:
CREATE EVENT sacrificial_zombie ON SCHEDULE AT CURRENT_TIMESTAMP DO |
BEGIN |
SELECT sleep(5); |
SELECT "Will never be printed if we KILL QUERY during SELECT sleep(5)"; |
SELECT sleep(6); |
END; |
If the KILL QUERY is executed against the thread running the above event it will result on everything after SELECT sleep(5) not being executed. While if I execute something like:
CREATE EVENT sacrificial_zombie ON SCHEDULE AT CURRENT_TIMESTAMP DO BEGIN DO sleep(5); DO sleep(6); END; |
and execute KILL QUERY against the thread running the event it will only terminates the execution of DO sleep(5); but the second part DO sleep(6) will be executed.