[MDEV-645] LP:1002146 - Unneeded filesort when executing a GROUP BY query Created: 2012-05-21 Updated: 2012-11-23 Resolved: 2012-11-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.3.11 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Igor Babaev | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
If to create tables t1 and t2 in MariaDB 5.5 as with the following commands CREATE TABLE t1 ( and set join_cache_level=0; then the execution plan for the query SELECT t2.col_int_key AS field1 will use unneeded filesort: MariaDB [test]> explain SELECT t2.col_int_key AS field1 FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.t_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1;
-----
----- |
| Comments |
| Comment by Rasmus Johansson (Inactive) [ 2012-05-21 ] | ||||||||||||||||||||||||||||||
|
Launchpad bug id: 1002146 | ||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2012-11-20 ] | ||||||||||||||||||||||||||||||
|
The same problem can be observed on mariadb-5.5 (rev 3574)with the query SELECT t2.col_int_key AS field1 when the engine is changed for MYISAM: MariaDB [test]> ALTER TABLE t1 ENGINE=MYISAM; MariaDB [test]> ALTER TABLE t2 ENGINE=MYISAM; MariaDB [test]> explain SELECT t2.col_int_key AS field1 FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.col_int_key <> 7 GROUP BY field1;
-----
----- | ||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2012-11-22 ] | ||||||||||||||||||||||||||||||
|
The bug is reproducible in mariadb-5.3 as well. | ||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2012-11-23 ] | ||||||||||||||||||||||||||||||
|
The fix was pushed into mariadb-5.3 (rev 3604) |