Note
For V4.4.2, this variable takes effect starting from V4.4.2 BP1.
For V4.6.x, this variable takes effect starting from V4.6.1.
Overview
max_execution_time applies only to setting 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 version of the cluster is V4.4.2 BP1 or later.
- The value of the
MAX_EXECUTION_TIMEparameter is greater than 0 (that is, this feature is enabled). - The currently executing SQL statement is a single, read-only
SELECTstatement.
Scenarios where the max_execution_time variable does not take effect and is controlled by the ob_query_timeout variable:
- The minimum cluster version is earlier than V4.4.2 BP1.
- The
MAX_EXECUTION_TIMEparameter is set to0. - Not for
SELECTstatements. - The statement is a multi-statement transaction, and the timestamp of
ob_query_timeoutis earlier than that ofmax_execution_time. - A
SELECTstatement that is not read-only. For example, if aSELECTstatement contains a UDF and the UDF defines DML, the timeout period for thisSELECTstatement 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 (in Oracle-compatible mode) and theinformation_schema.GLOBAL_VARIABLESview (in MySQL-compatible mode), to view the values of global system variables.Session level
The
SHOW VARIABLESstatement, or theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (in Oracle-compatible mode) and theinformation_schema.SESSION_VARIABLESview (in MySQL-compatible mode), can be used by thesystenant and all user tenants to view the values of session system variables.
Modify variables
The
systenant can directly modify the values of global system variables.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.Oracle user tenants must have the
ALTER SYSTEMprivilege to modify the values of global system variables.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Integer |
| Default Value | 0 indicatesmax_execution_timeThe system variable does not take effect. Use other timeout control methods, such asob_query_timeout. |
| Value range | [0, 4294967295] |
| Effective Scope |
|
| Modifiable | This variable can be obtained throughSET GLOBALThe statement modifies the value under global effective mode and supports passing inSETStatements modify the value under the session-effective mode. |
Configuration example
Set the execution timeout for the SELECT statement to 2 milliseconds.
obclient> SET GLOBAL max_execution_time=2;
