MariaDB 10.1.1 introduced the
max_statement_time system variable. When set to a non-zero value, any queries taking longer than this time in seconds will be aborted. The default is zero, and no limits are then applied. The aborted query has no effect on any larger transaction or connection contexts.
The value can be set globally or per session, as well as per user or per query (see below). Slave's are not affected by this variable.
An associated status variable,
max_statement_time_exceeded, stores the number of queries that have exceeded the execution time specified by
max_statement_time, and a
MAX_STATEMENT_TIME_EXCEEDED column was added to the
USER STATISTICS Information Schema tables.
The feature was based upon a patch by Davi Arnaut.
SET STATEMENT max_statement_time=100 FOR SELECT field1 FROM table_name ORDER BY field1;
MySQL 5.7.4 introduced similar functionality, but the MariaDB implementation differs in a number of ways.
max_statement_timeis defined in millseconds, not seconds
max_statement_time_exceededstatus variable, while MySQL also introduced a number of other variables which were not seen as necessary in MariaDB.
SELECT MAX_STATEMENT_TIME = N ...syntax is not valid in MariaDB.
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.