Analyse query

Get query with :

show full processlist;

Execute “explain” on the request :

explain select * from table;

The output can be analyzed directly or be used with another tool likepercona toolkit pt-visual-explain http://www.percona.com/doc/percona-toolkit/2.2/pt-visual-explain.html

This tool allow to easily understand :

- queries that do a full scan
- queries that lack discriminating character
- indexes that do not discriminate enough
- the structure of a query that could be improved without changing the functionality

http://dev.mysql.com/doc/refman/5.0/en/query-speed.html
http://dev.mysql.com/doc/refman/5.1/en/using-explain.html