mysql> select * from slowtech.t1 group by id;
+------+
| id |
+------+
| 2 |
| 3 |
| 1 |
+------+
3 rows in set (0.00 sec)
mysql> explain select * from slowtech.t1 group by id;
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-----------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-----------------+
| 1 | SIMPLE | t1 | NULL | ALL | NULL | NULL | NULL | NULL | 3 | 100.00 | Using temporary |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-----------------+
1 row in set, 1 warning (0.01 sec)
不仅结果没有升序输出,执行计划中也没有“Using filesort”。
可见,MySQL 8.0对于group by操作确实不再进行隐式排序。