max_execution_time
Limits elapsed SQL processing time for a request. The type is Float64 and the default is 0, meaning no additional time limit at the database scope.
Finite nonnegative fractional seconds are accepted, so 0.5 requests half a second.
Scope and changes
Use SET after selecting a server database. The change is persisted for that database and observed by other clients before later requests. It requires autocommit and no active transactions in the database. Resource limits are sampled once per request; a SET within a batch changes defaults for later requests.
A nonzero XML ceiling can only be tightened by the saved database value. Zero removes the database's additional ceiling while retaining any server ceiling. Inspect system.settings for effective values and main.settings for stored values.
Behavior
The deadline is shared across the request's statements and query threads. Checks are cooperative: a blocking operation can finish before a later check reports QUERY_TIME_LIMIT_EXCEEDED. This is a processing limit, separate from socket request_read_timeout.
Example
SET max_execution_time = 0.5;SELECT name, value
FROM system.settings
WHERE name = 'max_execution_time'
FORMAT csv;"max_execution_time","0.5"See request limits and server limits.