HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Query execution was interrupted, max_statement_time exceeded

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
querywasinterruptedexecutionexceededmax_statement_time

Problem

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

Solution

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

Code Snippets

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

SET session max_execution_time=300000;
SELECT @@session.max_execution_time -- 15000
select /*+ MAX_EXECUTION_TIME(300000) */ * from table
where ...

Context

StackExchange Database Administrators Q#134923, answer score: 3

Revisions (0)

No revisions yet.