Bug #59670 | unexpected results from query optimizer | ||
---|---|---|---|
Submitted: | 22 Jan 2011 1:26 | Modified: | 25 Mar 2011 17:36 |
Reporter: | Don Cohen | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 5.0.77-log | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[22 Jan 2011 1:26]
Don Cohen
[22 Jan 2011 9:28]
Valeriy Kravchuk
First of all, please, check if you get the same results with a recent version, 5.0.91. In any case, if you want specific index to be used you can try to force that: explain select * from iploc FORCE INDEX(ipend) where ipend>=1234567890 and ipstart<=1234567890 order by ipend asc limit 4;
[23 Jan 2011 7:20]
Don Cohen
> First of all, please, check if you get the same results with a recent > version, 5.0.91. I don't see an easy way to do that. In any case some of my questions seem independent of version, such as how can I figure out what algorithm is used from the output of explain select, and am I correct that the number of rows in the first explain select should have been 4. FORCE INDEX(ipend) is useful, thanks. Also I now think that the other queries are correctly optimized. When I change the limit to 1 then I get the performance I expect (fast when using ipend index) and it's asking for more than one that forces the rest of the rows to be examined.
[23 Jan 2011 11:05]
Valeriy Kravchuk
As for estimated number of rows when LIMIT is used, this looks like bug #50168. I doubt this problem will be fixed any time soon.
[25 Mar 2011 17:36]
Valeriy Kravchuk
Let's say this is a duplicate of bug #50168 (something to check again when that bug is fixed at least)