You are hereBlogs / moshe weitzman's blog / EXPLAIN for Devel query log - #D7CX

EXPLAIN for Devel query log - #D7CX


By moshe weitzman - Posted on 02 February 2010

The query log feature of devel.module has faithfully served us since 2002, relatively unchanged. Since then, the web learned about AJAX and now devel for Drupal 7 finally gets with the times.

In the ops column of the screenshot above, you will see three ajax links titled P, A, E. Those stand for Placeholders, Arguments, and EXPLAIN. They work as follows:

  • Placeholders. This is the default presentation of a query. Here we see SQL with placeholders instead of values. This is the most compact representation.
  • Arguments. This link retrieves the same SQL replaces placeholders with actual values. This presentation is helpful for debugging and for copy/paste into you mysql editor for optimization.
  • EXPLAIN. This link shows the EXPLAIN output for the query. This is super helpful for optimizing any slow query.

Also, The far right column is helpful for knowing which slave server actually executed a given query (master/slave is a new feature of D7).

One of my goals here is to help module maintainers to upgrade and optimize their modules. Go #D7CX. Devel is well along in its pledge having released Alpha-1

Tags

This will be so useful! Thank you.

That is superhot. Getting more people using EXPLAIN in development is a huge best-practice win. It's great to see devel.module continually adding these awesome new features! :)

Moshe,

You say "The query log feature of devel.module has faithfully served us since 2002, relatively unchanged. Since then, the web learned about AJAX and now devel for Drupal 7 finally gets with the times."

I assume this means that the EXPLAIN is run when you click on it rather than during execution?

Yes, thats correct. When you click that link, an AJAX request is fired off to the server and the server returns a table of results. We don't try to run EXPLAIN for every query in real time.

Yet another awesome Devel module feature :) Thanks Moshe!

This is great. Keep up the good work :)