MySQL Variables max_execution_time 数据库 参数变量解释及正确配置使用
本站中文解释
max_execution_time 是MySQL服务器中的一个用于控制单条语句最大允许执行时间的变量。超过这个时间,MySQL将会终止这条语句的执行,并返回一个错误信息。
在MySQL服务器中可以在my.cnf文件或者动态变量修改中设置该参数:
在my.cnf文件中,可以用max_execution_time参数来设置全局的max_execution_time,语法为:
max_execution_time= n
n 表示允许执行的最大时间,单位为秒。
在动态变量修改中可以使用以下命令来设置某个会话中max_execution_time变量的值:
SET @@GLOBAL.max_execution_time= n
n 表示允许执行的最大时间,单位为秒。
官方英文解释
max_execution_time
Command-Line Format | --max-execution-time=# |
---|---|
System Variable | max_execution_time |
Scope | Global, Session |
Dynamic | Yes |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
Unit | milliseconds |
The execution timeout for
SELECT
statements, in
milliseconds. If the value is 0, timeouts are not enabled.
max_execution_time
applies as
follows:
-
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 whichN
is 0. -
max_execution_time
applies to read-onlySELECT
statements. Statements that are not read only are those
that invoke a stored function that modifies data as a side
effect. -
max_execution_time
is
ignored forSELECT
statements in stored programs.