Skip to main content

Posts

Showing posts from May, 2010

MySQL Visual Explain – Hierarchical View of Query Execution Plan

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. Example query: SELECT actor_id, (SELECT COUNT(film_id) FROM sakila.film JOIN sakila.film_actor USING(film_id)) FROM sakila.actor;