Bug #118015 | The query which always return a empty result should not comsume executing time | ||
---|---|---|---|
Submitted: | 20 Apr 7:18 | Modified: | 19 May 14:52 |
Reporter: | jinhui lai | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
Version: | 9.2.0, 9.3.0 | OS: | Ubuntu (22.04) |
Assigned to: | CPU Architecture: | Any |
[20 Apr 7:18]
jinhui lai
[20 Apr 7:50]
jinhui lai
This problem also appears in mysql-9.3.0, but it is more obvious in mysql-9.2.0.
[20 Apr 14:12]
jinhui lai
The following sql is more obvious mysql> SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME INTERSECT (SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME WHERE 1=2); Empty set (2 min 20.52 sec)
[21 Apr 6:17]
jinhui lai
I executed this sql again, and it consumed more time. mysql> SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME INTERSECT (SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME WHERE 1=2); Empty set (7 min 35.59 sec)
[22 Apr 7:28]
jinhui lai
-- This is a supplementary information. mysql> use information_schema; mysql> FLUSH STATUS; Query OK, 0 rows affected (0.12 sec) mysql> SHOW SESSION STATUS LIKE 'Handler_read%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | Handler_read_first | 0 | | Handler_read_key | 0 | | Handler_read_last | 0 | | Handler_read_next | 0 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 0 | +-----------------------+-------+ 7 rows in set (0.01 sec) mysql> SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME INTERSECT (SELECT * FROM TABLES CROSS JOIN VIEWS ON TABLES.TABLE_NAME != VIEWS.TABLE_NAME WHERE 1=2); Empty set (7 min 26.01 sec) mysql> SHOW SESSION STATUS LIKE 'Handler_read%'; +-----------------------+---------+ | Variable_name | Value | +-----------------------+---------+ | Handler_read_first | 4 | | Handler_read_key | 1175343 | | Handler_read_last | 0 | | Handler_read_next | 1143786 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 1160390 | +-----------------------+---------+ 7 rows in set (0.00 sec)
[19 May 14:52]
MySQL Verification Team
Hello jinhui lai, Thank you for the report and feedback. Verifying for now but I could not see the magnitude of slowness you had observed in your tests (sorry couldn't check on docker) in as much as 15+ attempts at my end. Development team may have follow up questions/request for details and if needed will request you to share. Thank you once again. regards, Umesh