Debugging WordPress

The basic technique of logging queries is that if SAVEQUERIES constant is defined to be true (it’s not by default for performance reasons) then $wpdb->queries will keep the log of queries performed.

There isn’t anything on top of this that WordPress natively does. There are plenty of plugins around which work either by interpreting this data, or implementing additional data collection. Latter can get pretty intricate to implement and only done in more elaborate debug plugins.