Common SQL Errors

MySQL Error 3124 ER_WARN_BAD_MAX_EXECUTION_TIME: Unsupported MAX_EXECUTION_TIME - How to Fix and Prevent

Galaxy Team
August 8, 2025

The ER_WARN_BAD_MAX_EXECUTION_TIME warning appears when MySQL cannot enforce the MAX_EXECUTION_TIME hint or variable in the current server version or query context.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is ER_WARN_BAD_MAX_EXECUTION_TIME?

ER_WARN_BAD_MAX_EXECUTION_TIME warns that MySQL ignored your MAX_EXECUTION_TIME setting because the feature is unsupported in the current context. Upgrade to MySQL 5.7.8 or higher or remove the hint to resolve the warning.

Error Highlights

Typical Error Message

ER_WARN_BAD_MAX_EXECUTION_TIME

Error Type

Execution Warning

Language

MySQL

Symbol

ER_WARN_BAD_MAX_EXECUTION_TIME was added in 5.7.7.

Error Code

3124

SQL State

HY000

Explanation

Table of Contents

What is ER_WARN_BAD_MAX_EXECUTION_TIME?

The warning 'Unsupported MAX_EXECUTION_TIME' appears when a SELECT statement includes a MAX_EXECUTION_TIME hint or the session variable max_execution_time but the running MySQL version or storage engine does not support the feature. The server silently ignores the request and returns this warning so you know the limit was not enforced.

MySQL introduced MAX_EXECUTION_TIME in version 5.7.4 but refined support in 5.7.8. Prior releases and certain statement types cannot apply the limit, so the optimizer raises this HY000 warning. Ignoring it can leave runaway queries consuming resources and slowing your application.

What Causes This Error?

The most common trigger is running a query with the MAX_EXECUTION_TIME optimizer hint on a server older than 5.7.8. In 5.7.4-5.7.7 the hint was parsed but not executed, producing the warning.

Another cause is using storage engines or operations that bypass the optimizer, such as derived tables, UNION, or views that disallow the execution timer.

Setting the global or session variable max_execution_time on an unsupported version or inside stored programs compiled on earlier releases also raises the warning.

How to Fix ER_WARN_BAD_MAX_EXECUTION_TIME

First confirm your MySQL version with SELECT VERSION();. Upgrade to 5.7.8 or any 8.0 release to gain full support for execution time limits.

If an upgrade is impossible, remove the MAX_EXECUTION_TIME hint or variable from your statements and rely on application-side timeouts or the server parameter max_statement_time in Percona Server.

For queries that involve UNION or views, refactor them into simple SELECT statements or split the logic so the optimizer can apply the timer.

Common Scenarios and Solutions

Legacy code migrated from Percona Server often sets max_statement_time. Replace it with MAX_EXECUTION_TIME after upgrading to MySQL 8.0.

Some ORMs automatically inject optimizer hints. Disable the feature in the ORM config or wrap the query in a comment filter before sending to the database.

During ETL jobs Galaxy users can add a guard clause LIMIT 1000 or run the query in the Galaxy editor with a built-in 5-minute kill switch to avoid server-side warnings.

Best Practices to Avoid This Error

Always test new optimizer hints in a staging environment running the same MySQL version as production.

Use SELECT @@VERSION and SHOW VARIABLES LIKE 'max_execution_time' in deployment checks to block incompatible code.

Leverage Galaxy's AI copilot to suggest version-safe syntax and flag unsupported hints before queries reach production.

Related Errors and Solutions

ER_UNKNOWN_HINT warns when MySQL does not recognize a hint token. Remove or rewrite the hint.

ER_PARSE_ERROR is thrown when the hint syntax is malformed. Verify comment format /*+ MAX_EXECUTION_TIME(1000) */.

ER_QUERY_INTERRUPTED appears when the execution timer successfully aborts a query. Optimize indexes or batch the workload.

Common Causes

Server version below 5.7.8

The optimizer can parse but cannot enforce the timer, so it raises ER_WARN_BAD_MAX_EXECUTION_TIME.

Unsupported query constructs

UNION, derived tables, and views can bypass the optimizer, preventing the timer from activating.

Global variable misconfiguration

Setting max_execution_time globally on versions that lack support triggers the warning at runtime.

Related Errors

ER_UNKNOWN_HINT

The server does not recognize the provided optimizer hint token.

ER_QUERY_INTERRUPTED

The query exceeded its allowed runtime and was aborted by the server.

ER_PARSE_ERROR

General syntax error, often due to malformed hint comment structure.

FAQs

Does this warning stop my query?

No, the query still runs but without a time limit, so it may consume more resources.

Is MAX_EXECUTION_TIME available in MySQL 8.0?

Yes, all 8.0 releases fully support the hint and the max_execution_time variable.

Can I suppress the warning?

You can run SHOW WARNINGS after the query or set SQL_NOTES=0, but fixing compatibility is recommended.

How does Galaxy help?

Galaxy highlights unsupported hints in its editor and suggests version-compatible syntax before execution.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo