Bug #117598 | Wrong sort order for queries with ORDER BY DESC when using range comparison with LIMIT | ||
---|---|---|---|
Submitted: | 28 Feb 3:28 | Modified: | 28 Feb 7:21 |
Reporter: | Daniel Morton | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 8.0.35, 8.0.41, 8.4.4 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | regression |
[28 Feb 3:28]
Daniel Morton
[28 Feb 3:29]
Daniel Morton
Data to reproduce the issue
Attachment: inserts.sql (application/octet-stream, text), 40.87 KiB.
[28 Feb 7:21]
MySQL Verification Team
Hello Daniel Morton, Thank you for the report and test case. Verified as described. regards, Umesh
[1 Apr 5:09]
Andy Mok
I also ran into this same problem using the IN operator. Using the same table and data as OP and on version 8.0.35, here is a reproducible example: ``` > select pay_month, _id from employee_payment where employee_id = 'EMP010' and pay_month IN (829, 973) and status = 'PAID' order by pay_month desc, _id desc limit 10; +-----------+-----+ | pay_month | _id | +-----------+-----+ | 973 | 6 | | 973 | 13 | | 973 | 19 | | 973 | 20 | | 973 | 38 | | 973 | 87 | | 973 | 111 | | 973 | 124 | | 973 | 151 | | 973 | 168 | +-----------+-----+ 10 rows in set (0.001 sec) ```