MySQL的系统变量max_execution_time小结
参数介绍:
MySQL社区版MySQL 5.7.8开始,新增了MAX_EXECUTION_TIME这个系统变量,它用来限制SQL语句的执行时间,确切来说是限制只读SELECT语句。如果查询语句的执行时长超过这个阈值,MySQL将自动停止该SQL语句的执行。如果其值为 0,表示不启用该超时限制功能。该参数/变量单位是毫秒(milliseconds),千万要注意,单位是毫秒。不是秒。
官方文档[1]关于系统变量max_execution_time的描述如下:
The execution timeout for SELECT statements, in milliseconds. If the value is 0, timeouts are not enabled.<br><br>max_execution_time applies as follows:<br><br>The global max_execution_time value provides the default for the session value for new connections. The session value applies to SELECT executions executed within the session that include no MAX_EXECUTION_TIME(N) optimizer hint or for which N is 0.<br><br>max_execution_time applies to read-only SELECT statements. Statements that are not read only are those that invoke a stored function that modifies data as a side effect.<br><br>max_execution_time is ignored for SELECT statements in stored programs.or SELECT statements in stored programs.<br>