-- tested with MySQL 5.6 -- Missing index. Filesort and tmp table using more memory EXPLAIN SELECT name, status, SUM(price) FROM history GROUP BY name, status; -- index (name, status) EXPLAIN SELECT name, status, SUM(price) FROM history GROUP BY name, status;
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | history | null | ALL | null | null | null | null | 1407 | 100 | Using temporary |
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | history | null | index | name_status_idx | name_status_idx | 771 | null | 1407 | 100 | null |