The MAX_EXECUTION_TIME optimizer hint was used on a statement type that does not support it, so MySQL returns warning 3125.
MySQL error 3125 ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME occurs when the MAX_EXECUTION_TIME optimizer hint is applied to anything other than a top-level SELECT. Remove the hint or move it to the outermost SELECT to resolve the warning.
ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME
Error 3125 signals that MySQL accepted your query but ignored the MAX_EXECUTION_TIME hint because it was not placed on a top-level SELECT. The server records a warning instead of stopping execution.
The hint was introduced in MySQL 5.7.7 and only affects SELECT statements. Using it on UPDATE, DELETE, INSERT, or on subqueries makes it unsupported and therefore triggers this warning.
The primary cause is placing MAX_EXECUTION_TIME inside a subquery or on a non-SELECT statement. MySQL scans the query tree and validates hints only for the topmost SELECT.
Another trigger is older client code that adds the hint generically to every statement, regardless of type, resulting in warnings during data-modifying operations.
Ensure the hint appears only on the outermost SELECT. If you need execution-time limits for other operations, remove the hint and rely on max_execution_time session variable instead.
You can also silence the warning by enabling sql_notes = 0 before running the query, though the preferred fix is correcting statement placement.
In reporting dashboards, object-relational mappers may prepend the hint to subqueries. Rewrite the query so the main SELECT wraps the logic, then attach the hint to that wrapper.
For data migration scripts that run UPDATE ... SELECT, drop the hint entirely because updates are unsupported. Manage run-time with lock_wait_timeout or batch processing.
Centralize query generation and validate that hints are appended conditionally. Use code review or linting rules to block unsupported hints on DML statements.
Teams using Galaxy can create endorsed templates that show correct use of optimizer hints, letting developers reuse safe patterns without manual checks.
ER_WARN_DEPRECATED_SYNTAX warns when you use outdated syntax; upgrade queries to modern forms. ER_PARSE_ERROR arises from malformed hints; verify brackets and syntax.
MAX_EXECUTION_TIME added to data-modification statements that do not honor it.
Placed within an EXISTS, IN, or derived table rather than the top-level SELECT.
Automatic code adds the hint indiscriminately to every statement type.
Older script predates MySQL 5.7.7 support rules and now triggers the warning.
Warns about outdated or removed features; occurs when using deprecated optimizer hints.
Raised when hint syntax is malformed, such as missing parentheses.
Occurs when max_execution_time kills a running query; check for long running queries.
No. MySQL runs the statement but ignores the unsupported hint.
No. The hint is valid only for top-level SELECT. Use other timeout controls for DML.
Set sql_notes = 0 for the session, but correct placement is the recommended fix.
None, aside from minimal overhead parsing the unused hint.