Bug #1335 "Filesort" is missing in EXPLAIN
Submitted: 18 Sep 2003 10:06 Modified: 9 Dec 2003 14:21
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.15 OS:
Assigned to: Konstantin Osipov CPU Architecture:Any

[18 Sep 2003 10:06] Peter Zaitsev
Description:
According to discussion with Igor this query uses filesort on group by for its
execution however it is missing in explain, furthermore the fact is missing what temporary table is used for count(distinct) 

mysql> explain select i,count(distinct(i)) from fs group by j order by null;
+-------+------+---------------+------+---------+------+------+-------+
| table | type | possible_keys | key  | key_len | ref  | rows | Extra |
+-------+------+---------------+------+---------+------+------+-------+
| fs    | ALL  | NULL          | NULL |    NULL | NULL |    6 |       |
+-------+------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

How to repeat:
CREATE TABLE fs (
  i int(11) default NULL,
  j int(11) default NULL
) TYPE=MyISAM;

--
-- Dumping data for table 'fs'
--

INSERT INTO fs VALUES (1,2),(2,3),(4,5),(3,5),(1,5),(23,5);

explain select i,count(distinct(i)) from fs group by j order by null;
[9 Dec 2003 14:21] Konstantin Osipov
Fixed in MySQL 4.0.17: bk commit - 4.0 tree (konstantin:1.1625)