Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizer: invalid hint addition renders other hints in the hint set ineffective #49308

Closed
mcdeea opened this issue Dec 8, 2023 · 0 comments · Fixed by #49441
Closed

Optimizer: invalid hint addition renders other hints in the hint set ineffective #49308

mcdeea opened this issue Dec 8, 2023 · 0 comments · Fixed by #49441
Assignees

Comments

@mcdeea
Copy link

mcdeea commented Dec 8, 2023

Bug Report

When there is an invalid hint in a hint set, the behaviour in TiDB is different than MySQL. MySQL respects the other valid hints while TiDB ignore all the hints in the set.

1. Minimal reproduce step (Required)

mysql> SELECT /*+ MAX_EXECUTION_TIME(10) */ SLEEP(5);
mysql> SELECT /*+ MAX_EXECUTION_TIME(10), dtc(name=tt) */ SLEEP(5);

2. What did you expect to see? (Required)

Result from MySQL : Server version: 5.7.44 MySQL Community Server (GPL)

mysql> SELECT /*+ MAX_EXECUTION_TIME(10) */ SLEEP(5);
+----------+
| SLEEP(5) |
+----------+
|        1 |
+----------+
1 row in set (0.01 sec)

mysql> SELECT /*+ MAX_EXECUTION_TIME(10), dtc(name=tt) */ SLEEP(5);
+----------+
| SLEEP(5) |
+----------+
|        1 |
+----------+
1 row in set, 1 warning (0.01 sec) <-  hint MAX_EXECUTION_TIME(5) was respected

3. What did you see instead (Required)

Result from TiDB v6.5.4

mysql> SELECT /*+ MAX_EXECUTION_TIME(5) */ SLEEP(5);
--------------
SELECT /*+ MAX_EXECUTION_TIME(5) */ SLEEP(5)
--------------

+----------+
| SLEEP(5) |
+----------+
|        1 |
+----------+
1 row in set (0.07 sec)

mysql> SELECT /*+ MAX_EXECUTION_TIME(5), dtc(name=tt) */ SLEEP(5);
--------------
SELECT /*+ MAX_EXECUTION_TIME(5), dtc(name=tt) */ SLEEP(5)
--------------

+----------+
| SLEEP(5) |
+----------+
|        0 |
+----------+
1 row in set, 1 warning (5.00 sec)  <-- hint MAX_EXECUTION_TIME(5) was ignored

4. What is your TiDB version? (Required)

6.5.4

@mcdeea mcdeea added the type/bug The issue is confirmed as a bug. label Dec 8, 2023
@mcdeea mcdeea changed the title Optimizer: invalid hint addition renders other hints in the hint set Ineffective Optimizer: invalid hint addition renders other hints in the hint set ineffective Dec 8, 2023
@jebter jebter added the sig/planner SIG: Planner label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants