Bug #68252 Implementation of server-side statement timeout support
Submitted: 2 Feb 2013 1:15 Modified: 24 Mar 2014 14:12
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: feature, query, statement, timeout

[2 Feb 2013 1:15] Davi Arnaut
Description:
This contributed change introduces a server-side concept of interrupting
the execution of a statement that takes over a specified number of time
units to complete. After the specified number of time units has passed,
the server attempts to terminate the statement without affecting the
session (connection) itself.

How to repeat:
No steps.
[2 Feb 2013 1:16] Davi Arnaut
Implementation of server-side statement timeout support

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: Implement-server-side-statement-timeout-support.patch (application/octet-stream, text), 110.07 KiB.

[2 Feb 2013 2:51] MySQL Verification Team
This is a much requested feature, thanks Davi!
[24 Mar 2014 14:12] Paul DuBois
Noted in 5.7.4 changelog entry.

MySQL now supports server-side timeouts for execution of SELECT
statements:

* SELECT supports a MAX_STATEMENT_TIME option to specify a timeout for
  individual queries. For example:

  SELECT MAX_STATEMENT_TIME = 5000 id, name FROM my_table WHERE ...

* The max_statement_time system variable specifies the timeout value
  for SELECT statements executed within the session that include no
  MAX_STATEMENT_TIME option. If the value is 0, timeouts are not
  enabled.

* The Max_statement_time_exceeded, Max_statement_time_set, and
  Max_statement_time_set_failed status variables provide information
  about SELECT statements affected by timeouts.

Timeout values are in milliseconds.

Thanks to Davi Arnaut for the patch on which this feature is based.