Bug #114741 | Inconsistent query results caused by different execution of subqueries | ||
---|---|---|---|
Submitted: | 23 Apr 2024 9:43 | Modified: | 23 Apr 2024 12:59 |
Reporter: | John Jove | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[23 Apr 2024 9:43]
John Jove
[23 Apr 2024 10:22]
MySQL Verification Team
Hi Mr. Jove, Thank you for your bug report. However, we do not see what bug are you reporting. The only difference in the two queries is that you were forcing a join order in two different ways. When you leave the Optimiser to do its job on itself, it works fine. However, optimiser hints are enforced on the optimiser. Simply, optimiser has to obey programmer's commands. So, when you specify a wrong join order , you will get wrong results. That is expected behaviour. Hence, we do not se why should this be considered a bug.
[23 Apr 2024 12:04]
MySQL Verification Team
Hi Mr. Jove, We have decided that this is a bug. A low severity bug, but still a bug. The bug lies in the fact that a query does not contain a single explicit join statement. Some of the nested queries are optimised as a join, but this optimiser hint should not apply in those cases. We have repeated your results with 8.0.36, 8.0.37 and 8.3.0. This is now a verified bug report.
[23 Apr 2024 12:52]
John Jove
Thank you for the quick response. Actually, the above two queries do have NATURAL JOIN clauses. I quite agree that optimizer hints should not be abused to enforce a potential error behavior of the query optimizer. By the way, I will attach the original bug report returned by my tool, in which the same query is executed by different plans without enforcing query hints. That means that these above two executions can also be chosen by the optimizer without query hints.
[23 Apr 2024 12:59]
John Jove
For easy of reproducing this issue, I add such hints in the query, since the runtime environment could be different. Thanks again.
[23 Apr 2024 13:36]
MySQL Verification Team
You are truly welcome.