3066
MySQLWARNINGCriticalPerformanceHIGH confidence
MAX_EXECUTION_TIME hint is ignored for non-SELECT statements
Production Risk
Low — hint is silently ignored; the statement runs without a time limit.
What this means
The MAX_EXECUTION_TIME optimizer hint is only applicable to top-level SELECT statements. When used in DML or procedural contexts it is silently ignored.
Why it happens
- 1Using /*+ MAX_EXECUTION_TIME(N) */ in an INSERT, UPDATE, DELETE, or stored procedure.
How to reproduce
trigger — this will error
trigger — this will error
UPDATE /*+ MAX_EXECUTION_TIME(1000) */ t SET col=1 WHERE id=1;
expected output
Warning (Code 3066): MAX_EXECUTION_TIME hint is ignored as the query is a non-SELECT statement.
Fix
Use max_execution_time only on SELECT statements
Use max_execution_time only on SELECT statements
SELECT /*+ MAX_EXECUTION_TIME(1000) */ * FROM t WHERE id=1;
Why this works
The hint is only effective on top-level read queries.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3066 ER_NON_RO_SELECT_DISABLE_TIMER3
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev