Mysql – Query execution was interrupted, max_statement_time exceeded

MySQLmysql-5.7

I'm getting following error via Microsoft IIS 8' Error Log:

Query execution was interrupted, max_statement_time exceeded

MySQL is 5.7.11-log running on Windows 2012 and per MySQL :: MySQL Server Version Reference :: 1.5 Option/Variable Changes for mysqld 5.7 max_statement_time was introduced in 5.7.4 and removed in 5.7.8, but error still there…

This feature with some changes was ported from Twitter MySQL patches Statement Timeout ยท twitter/mysql Wiki.

WITHOUT switching to MySQL fork maintained and used at Twitter, what are my other options?

Please advise.


* UPDATE *

MySQL Bugs: #81071: Query execution was interrupted, max_statement_time exceeded

Best Answer

I was experiencing the same issue. Possible to set the global max_execution_time, but not the session max_execution_time:

SET global max_execution_time = 60000;  
SELECT @@global.max_execution_time -- 60000

SET session max_execution_time=300000;
SELECT @@session.max_execution_time -- 15000

I used a hint as workaround:

select /*+ MAX_EXECUTION_TIME(300000) */ * from table
where ...

Source: https://stackoverflow.com/questions/415905/how-to-set-a-maximum-execution-time-for-a-mysql-query