On MySQL 8, all optimizer hints parsed before a syntax error will be accepted:
$ echo 'SELECT SLEEP(1);' | mysql -u root
SLEEP(1)
0
$ echo 'SELECT /*+ max_execution_time(2) */ SLEEP(1);' | mysql -u root
SLEEP(1)
1
$ echo 'SELECT /*+ max_execution_time(2) (error) */ SLEEP(1);' | mysql -u root
SLEEP(1)
1
$ echo 'SELECT /*+ (error) max_execution_time(2) */ SLEEP(1);' | mysql -u root
SLEEP(1)
0
(returning 0 means hint is ignored, returning 1 means hint is used)
On TiDB Parser, however, once an error is encountered the entire list of hints are thrown out, different from MySQL's behavior.
(TiDB Parser version = 89ae120)
On MySQL 8, all optimizer hints parsed before a syntax error will be accepted:
(returning 0 means hint is ignored, returning 1 means hint is used)
On TiDB Parser, however, once an error is encountered the entire list of hints are thrown out, different from MySQL's behavior.
(TiDB Parser version = 89ae120)