| Bug #119442 | Optimizer fails to simplify ORDER BY when column is filtered by IS NULL, causing filesort | ||
|---|---|---|---|
| Submitted: | 21 Nov 2025 20:13 | Modified: | 13 Aug 17:10 |
| Reporter: | Kishore Kumar (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
| Version: | 8.4.4 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | filesort, INDEX, IS NULL, Optimizer, order by | ||
[21 Nov 2025 20:13]
Kishore Kumar
[23 Nov 2025 2:07]
Kishore Kumar
Marking OS & CPU arch to any.
[25 Nov 2025 23:19]
OCA Admin
Contribution submitted via Github - Bug #119442: Fix ORDER BY optimization doesn't recognize IS NULL as constant (*) Contribution by Kishore Kumar (Github akcube, mysql-server/pull/637#issuecomment-3577811434): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: git_patch_3036837769.txt (text/plain), 28.44 KiB.
[27 Nov 2025 4:52]
Chaithra Marsur Gopala Reddy
Hi Kishore Kumar, Thank you for the test case. Verified as described. and thank you also for the contribution.
[28 May 1:13]
MySQL Admin
Posted by developer: Bug status updated to 'Patch pending'
[16 Jun 8:48]
MySQL Admin
Posted by developer: Bug status updated to 'Patch approved'
[17 Jun 8:48]
MySQL Admin
Posted by developer: Bug status updated to 'Documenting'
[13 Aug 17:10]
Edward Gilmore
Posted by developer:
Added the following note to the MySQL Server 9.7.2 and 26.7.0 release notes:
Queries that filtered an indexed column with IS NULL could
perform an unnecessary filesort when the same column appeared in
ORDER BY.
As of this release, the optimizer recognizes IS NULL as a
constant condition for order-by simplification, allowing index
order to be used when applicable.
Our thanks to Kishore Kumar for the contribution.
