> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1900-to-1999/e1969.md).

# Error 1969: Query was interrupted: execution time limit exceeded

| Error Code | SQLSTATE | Error                  | Description                                             |
| ---------- | -------- | ---------------------- | ------------------------------------------------------- |
| 1969       | 70100    | ER\_STATEMENT\_TIMEOUT | Query was interrupted: execution time limit %s exceeded |

Before MariaDB 12.2, the message is `Query execution was interrupted (max_statement_time exceeded)`.

## Possible Causes and Solutions

The statement ran longer than its time limit, and the server stopped it. The limit comes from one of these:

* The [max\_statement\_time](/docs/server/server-management/variables-and-modes/server-system-variables.md#max_statement_time) system variable, in seconds, set globally, for the session, for one statement with [SET STATEMENT](/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-statement.md), or for an account with `GRANT … WITH MAX_STATEMENT_TIME`.
* The [MAX\_EXECUTION\_TIME](/docs/server/ha-and-performance/optimization-and-tuning/optimizer-hints/expanded-optimizer-hints.md#max_execution_time) optimizer hint of a `SELECT`, in milliseconds, from MariaDB 12.0.

For example:

```
SET STATEMENT max_statement_time=0.1 FOR SELECT SLEEP(1) FROM seq_1_to_3;
ERROR 1969 (70100): Query was interrupted: execution time limit 0.1 sec exceeded
```

Only the statement is rolled back. If it ran inside a transaction, the transaction stays open with its earlier changes, and you have to commit it or roll it back.

To solve the error:

* Find out [why the statement is slow](/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations.md). Start with [EXPLAIN](/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain.md) or [ANALYZE](/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-statement.md). Often an index is missing.
* If the statement is expected to run long, raise the limit for it only, for example with `SET STATEMENT max_statement_time=600 FOR …`, or set it to 0 for the session to remove the limit.
* Check where the limit comes from: `SELECT @@GLOBAL.max_statement_time, @@SESSION.max_statement_time`, and [SHOW GRANTS](/docs/server/reference/sql-statements/administrative-sql-statements/show/show-grants.md) for a per-account limit.

The [max\_statement\_time\_exceeded](/docs/server/server-management/variables-and-modes/server-status-variables.md#max_statement_time_exceeded) status variable counts the statements that were stopped. On a replica, [slave\_max\_statement\_time](/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables.md#slave_max_statement_time) limits replicated statements, and gives a separate error. MySQL's error for the same case is [error 3024](/docs/server/reference/error-codes/mariadb-error-codes-3000-to-3099/e3024.md). See also [Aborting Statements that Exceed a Certain Time to Execute](/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/aborting-statements.md).

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
