Note
This variable is available starting with V4.4.2 BP1.
Description
max_execution_time specifies the execution timeout for read-only SELECT statements in milliseconds.
Considerations
The max_execution_time variable takes effect only in the following scenarios:
- The cluster version meets the requirements: the minimum cluster version is V4.4.2 BP1 or later.
- The value of the
MAX_EXECUTION_TIMEparameter is greater than 0 (indicating that the feature is enabled). - The current SQL statement is a single, read-only
SELECTstatement.
The max_execution_time variable does not take effect in the following scenarios, and is instead controlled by the ob_query_timeout variable:
- The cluster version is earlier than V4.4.2 BP1.
- The value of the
MAX_EXECUTION_TIMEparameter is0. - The SQL statement is not a
SELECTstatement. - The SQL statement is a multi-statement and the timestamp of
ob_query_timeoutis earlier than that ofmax_execution_time. - The SQL statement is a
SELECTstatement but is not read-only. For example, if aSELECTstatement contains a user-defined function (UDF) that defines a data manipulation language (DML) operation, the timeout for theSELECTstatement is controlled byob_query_timeout.
Privilege requirements
Query variables
Global level
The
systenant and all user tenants can use theSHOW VARIABLESstatement or theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the value of a global system variable.Session level
The
systenant and all user tenants can use theSHOW VARIABLESstatement or theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) or theinformation_schema.SESSION_VARIABLESview (MySQL mode) to view the value of a session system variable.
Modify variables
The
systenant can directly modify the value of a global system variable.A MySQL user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.An Oracle user tenant must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Integer |
| Default value | 0, indicating that the max_execution_time system variable does not take effect and other timeout control methods, such as ob_query_timeout, are used. |
| Value range | [0, 4294967295] |
| Scope |
|
| Modifiable | Yes. You can execute the SET GLOBAL statement to modify the value of the variable in Global mode, and execute the SET statement to modify the value of the variable in Session mode. |
Examples
Set the execution timeout of a SELECT statement to 2 milliseconds.
obclient> SET GLOBAL max_execution_time=2;
