How to Debug Queries Using Devel

In Drupal 7 you can query the database in two ways; using a static query or a dynamic query. A static query is the simplest of the two, all you need to do is pass a query and arguments using the db_query function. Most of your queries should be a static query because they are the fastest and the simplest.

Dynamic queries on the other hand allow other modules to modify a query by implementing the hook_query_alter hook. But beware dynamic queries are slower than static queries.


drush dl devel