EXPLAIN statement is used to obtain information about how MySQL executes a SELECT statement to check whether indexes are being used properly, and what kind of join is being performed. EXPLAIN output can sometimes be very hard to understand when it comes to long and complex queries.
Here comes MySQL Visual Explain, a command-line tool that transforms EXPLAIN output into a hierarchical view of the query execution plan. MySQL Visual Explain collects the output of EXPLAIN in MySQL and visualize it in treeview to make the reading more understandable. It is very useful when you have large and complex queries.
How It Works:
MySQL Visual Explain tries to reverse-engineer MySQL’s EXPLAIN output into a query execution plan, which it then formats as a left-deep tree — the same way the plan is represented inside MySQL.
SELECT actor_id, (SELECT COUNT(film_id) FROM sakila.film JOIN sakila.film_actor USING(film_id)) FROM sakila.actor;
MySQL Visual Explain output:
For more info, read the Introducing MySQL Visual Explain on Xaprb or the online documentation at the MySQL Toolkit homepage. You can download MySQL Visual Explain free from the Sourceforge MySQL Toolkit project page.