MySQL cannot resolve the optimizer hint name specified in the /*+ */ comment of a statement.
ER_UNRESOLVED_HINT_NAME occurs when MySQL 5.7.7 or later cannot match the hint name provided in an optimizer hint comment with any valid hint for the clause being targeted. Correct the spelling, use a supported hint for your server version, or remove the invalid hint to resolve the error.
ER_UNRESOLVED_HINT_NAME
Error 3128 appears when MySQL fails to map the name inside an optimizer hint comment to a supported hint. Starting in 5.7.7, MySQL introduced parser validation for hints and raises ER_UNRESOLVED_HINT_NAME if the name is misspelled, unsupported, or used in the wrong context.
The server stops parsing hints at the first unresolved name, skips the remaining hints, and continues executing the statement with default optimization rules. Although the query still runs, the intended tuning directive is ignored, so performance may differ from expectations.
Misspelled hint names are the top reason: a typo like INDEXES instead of INDEX can trigger the error immediately. Version mismatch also matters - a hint introduced in MySQL 8.0 will not be recognized by 5.7.x and will raise ER_UNRESOLVED_HINT_NAME.
Using a clause-specific hint in the wrong place, such as JOIN_ORDER inside a SELECT list rather than the SELECT hint list, produces the same error. Finally, forgetting to qualify table aliases inside hints can leave MySQL unable to resolve the identifier.
Start by checking the exact spelling of every hint in the /*+ */ block. Cross-reference with the MySQL manual for your server version to ensure the hint is valid and supported.
If the hint is new to a later release, remove it or upgrade MySQL. When table aliases are involved, prefix the hint with the correct alias, for example INDEX(t1 idx_user_id) instead of INDEX(idx_user_id).
Developers migrating queries from MySQL 8.0 to 5.7 often leave in BKA or NO_ICP hints that 5.7 cannot parse. Removing or replacing them with equivalent optimizer switches resolves the error quickly.
Automated query generators may output empty hint slots such as MAX_EXECUTION_TIME() if no value is supplied. Adding the required argument or deleting the hint prevents ER_UNRESOLVED_HINT_NAME.
Validate hints in staging before deploying to production. Pair continuous-integration checks with the SELECT /*+ SET_VAR(optimizer_switch='derived_merge=off') */ 1 technique to make sure hints compile.
Use Galaxy’s schema-aware autocomplete, which lists only hints supported by the connected MySQL version. This minimizes typos and version drift.
ER_UNSUPPORTED_HINT (3130) surfaces when the hint syntax is recognized but not allowed for the statement type. ER_WARN_UNSUPPORTED_HINT (3129) logs a warning rather than an error for non-critical mismatches. Both can be fixed by adjusting or deleting the offending hint.
Typing NOICP instead of NO_ICP or INDEXES instead of INDEX leads MySQL to reject the name as unresolved.
Running a query written for 8.0 on 5.7.x introduces hints like BKA that the older server does not recognize.
Placing a JOIN-specific hint in a SELECT-level hint list (or vice versa) causes the optimizer to flag the name as unresolved for that clause.
Hints referencing an index or table must match the alias used in the FROM clause. Omitting the alias breaks resolution.
The hint name is known but not allowed in the statement context. Remove or move the hint.
MySQL logs a warning instead of throwing an error when a non-critical hint is ignored.
Generic syntax error that may appear if the hint comment itself is malformed.
The query runs, but MySQL ignores the hint, so performance may differ from your expectations. It is safer to fix the hint.
Upgrading may add support for newer hints, but any misspellings or context issues will still raise ER_UNRESOLVED_HINT_NAME.
Consult the MySQL manual for your exact version, or run SHOW OPTIMIZER_HINTS in 8.0.29+ to list supported hints.
Galaxy’s context-aware autocomplete shows only hints valid for the connected database version and flags typos in real time.