# Error 3024: Query execution was interrupted, maximum statement execution time exceeded

| Error Code | SQLSTATE | Error              | Description                                                                |
| ---------- | -------- | ------------------ | -------------------------------------------------------------------------- |
| 3024       |          | ER\_QUERY\_TIMEOUT | Query execution was interrupted, maximum statement execution time exceeded |

## Possible Causes and Solutions

The cause is that the executing statement took more than [max\_statement\_time](/docs/server/server-management/variables-and-modes/server-system-variables.md#max_statement_time) (primary) or [slave\_max\_statement\_time](/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables.md#slave_max_statement_time) (replica) to execute.

To fix this, you have to either increase the value of [max\_statement\_time](/docs/server/server-management/variables-and-modes/server-system-variables.md#max_statement_time) or find out [why the query is slow](/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations.md). Start by doing an [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) on the query to find out how the query is executed.

## 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" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-3000-to-3099/e3024.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
