The following query will indicate whether the query uses an index or not:
EXPLAIN EXTENDED SELECT col1, col2, col3, COUNT(1) FROM table_name WHERE col1 = val GROUP BY col1 ORDER BY col2; SHOW WARNINGS;
You can add a coverage index for better performance.
For the coverage index, you add columns that are used when clauses are first, and then columns used in the group by columns that are used in order, and then columns used in select.
eg. for the request above, you can add the coverage index KEY(col1, col2, col3)
* Note. Adding additional indexes will slow down your insertion requests.
Omesh source share