Bug #112362 | WHERE NOT IN with subquery is much slower on 8.1 than 5.7 | ||
---|---|---|---|
Submitted: | 15 Sep 2023 20:19 | Modified: | 25 Sep 2023 14:12 |
Reporter: | Bradley Grainger (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
Version: | 8.1.0, 8.0.34 | OS: | Ubuntu (22.04) |
Assigned to: | CPU Architecture: | x86 | |
Tags: | regression |
[15 Sep 2023 20:19]
Bradley Grainger
[19 Sep 2023 11:27]
MySQL Verification Team
Hi Mr. Grainger, Thank you for your bug report. However, there are literally hundreds of bug reports , which show significant slowdown for the read or write DMLs between 5.7 and 8.0/8.1. This is a widely known fact. We have found these bugs in this forum that show that behaviour: https://bugs.mysql.com/bug.php?id=94387, https://bugs.mysql.com/bug.php?id=93734, https://bugs.mysql.com/bug.php?id=94283 However, we have found one bug, with exactly WHERE NOT IN, but this is an internally reported bug, which is not visible to you. Hence, the performance degradation from 5.7 to 8.0 / 8.1 is very well known fact. Duplicate.
[25 Sep 2023 14:12]
MySQL Verification Team
Hello Bradley Grainger, Thank you for the report and test case. Verified as described. regards, Umesh
[25 Sep 2023 14:13]
MySQL Verification Team
Test results - 8.0.11+, 5.7.43
Attachment: Bug112362_5.7.43_8.0.11_8.0.34_8.1.0.txt (text/plain), 18.09 KiB.
[26 Sep 2023 10:34]
Roy Lyseng
Posted by developer: Pretty strange nobody have noticed this regression before. The "problem" with semi-join and anti-join is that it converts a single-table query into a multi-table query, by dragging in the subquery tables, and the index range scan algorithm is only implemented for single-table queries. Until this has been fixed, there is a simple workaround that you can try: disable semi-join (and anti-join) conversion by this command: set optimizer_switch='semijoin=off'; or use the equivalent query hint.