You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Support Optimizer Hints in generated queries #4353
Apologies for the misleading description in the original issue.
After further investigation, the inline form is already supported and works correctly:
SELECT/*+ MAX_EXECUTION_TIME(1000) */*FROM t1 INNER JOIN t2 WHERE ...
The actual problem is with multi-line hints, where the hint comment appears on its own line:
SELECT/*+ MAX_EXECUTION_TIME(1000) */*FROM t1 INNER JOIN t2 WHERE ...
This is valid MySQL syntax, but sqlc's treats any line that starts with /* and ends with */ as a regular block comment and removes it — which inadvertently strips optimizer hints written in this style.
Activity
replu commentedon Apr 7, 2026
Apologies for the misleading description in the original issue.
After further investigation, the inline form is already supported and works correctly:
The actual problem is with multi-line hints, where the hint comment appears on its own line:
This is valid MySQL syntax, but sqlc's treats any line that starts with /* and ends with */ as a regular block comment and removes it — which inadvertently strips optimizer hints written in this style.
Preserve MySQL optimizer hints in stripped query text
Preserve MySQL optimizer hints in generated query text (sqlc-dev#4382)