Bug #37264 | MySQL wrongly uses filesort | ||
---|---|---|---|
Submitted: | 7 Jun 2008 22:35 | Modified: | 16 Oct 2008 3:58 |
Reporter: | jocelyn fournier (Silver Quality Contributor) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
Version: | 5.1.24-rc 5.1.29-rc 5.1.30 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc, regression |
[7 Jun 2008 22:35]
jocelyn fournier
[11 Jun 2008 14:01]
Susanne Ebrecht
Many thanks for writing a bug report. Verified as described by using 5.1 bzr tree from today.
[26 Jun 2008 14:38]
Sergey Petrunya
> With MySQL 5.1, MySQL is not able to use an index to avoid filesorting without analyzing the table. ANALYZE command produces table statistics. Generally (and in this particular case) it is not realistic to expect the query optimizer to make the right choices without having any statistics. > This is especially problematic for MEMORY table for which the ANALYZE command is not available, altough FORCE INDEX could be used to solve the problem. Index statistics for BTREE indexes over HEAP tables can be considered a reasonable feature request. > Hence performances on 5.1 could be worse than 5.0 in that specific case. Yes, alas, there may be isolated cases like this. At the moment we can only offer to use hint for this particular case.
[26 Jun 2008 14:40]
Sergey Petrunya
Changing status to To Be Fixed Later
[26 Jun 2008 14:41]
Sergey Petrunya
At the moment, we have no intent to fix this in MySQL 5.1
[26 Jun 2008 14:56]
jocelyn fournier
Hi Sergey, "ANALYZE command produces table statistics. Generally (and in this particular case) it is not realistic to expect the query optimizer to make the right choices without having any statistics." If no statistics info are available, if would perhaps be safer to always use index to mimic the 5.0 behaviour, instead of doing a wrong guess ? I assume the change in 5.1 behaviour here is an optimisation to try to not use index to avoid filesorting if the query returns more than 2/3 of the total rows of the table ?