Bug #115560 | JSON functional index not being considered for NULL check | ||
---|---|---|---|
Submitted: | 10 Jul 2024 15:43 | Modified: | 12 Jul 2024 8:13 |
Reporter: | Tanel K | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.38 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[10 Jul 2024 15:43]
Tanel K
[10 Jul 2024 17:40]
MySQL Verification Team
Hi Mr. K, Thank you for your bug report. However , it is not a bug. With a small number of rows, it is too expensive to use index. Scanning rows is much , much faster in those cases. Try the same with ten thousand rows or similar. Not a bug.
[10 Jul 2024 20:25]
Tanel K
Hey! I've tried it with all sorts of cardinality and 1-to-1 comparison with a real CHAR column - I can never get the JSON variant to use index when the real one does. The described steps were the shortest route to reproduction on my end, with an actual CHAR column with the same steps, the index was consulted. Thanks for swift answer, hoping you can spare another look!
[11 Jul 2024 6:12]
Knut Anders Hatlen
I think this is a reasonable enhancement request. We already have bug#104713 reported for using functional indexes for LIKE. That bug report does not cover IS NULL/IS NOT NULL, but I think that sounds like a good idea too.
[12 Jul 2024 5:29]
Tanel K
Should I enter a new submission with just the NULL check behavior to differentiate it from the LIKE bug?
[12 Jul 2024 8:11]
Knut Anders Hatlen
I think it's fine to keep this bug for IS NULL/IS NOT NULL. I've adjusted the bug title (removed "wildcard") and reopened it.