MariaDB [test]> explain select a, b, count(a) from t1 group by a, b order by a desc;
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
| 1 | SIMPLE | t1 | index | NULL | a | 10 | NULL | 100 | Using index; Using temporary; Using filesort |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [test]> explain select a, b, count(a) from t1 group by a desc, b order by a desc;
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
| 1 | SIMPLE | t1 | index | NULL | a | 10 | NULL | 100 | Using index; Using temporary; Using filesort |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+----------------------------------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [test]> explain select a, b, count(a) from t1 group by a desc, b desc order by a desc;
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| 1 | SIMPLE | t1 | index | NULL | a | 10 | NULL | 100 | Using index |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|