Here is a quickie: if you’re trying to get the most out of your server hardware running your WordPress-powered website, you’ll need to know how it is doing coping with WP intensive escu-eling:

Put this in wp-config.php:
define(‘SAVEQUERIES’, true);
Put this in your theme’s footer.php:
if ( current_user_can(‘manage_options’) ) {
echo ““;

Now, the SQL queries that it makes will be saved, and the results will be visible on any page when you are logged in as an administrator.

The query information will be a big array of lots of stuff. Each row will have:

  1. The SQL of the query.
  2. How long it took to run (milliseconds).
  3. What internal function called the query.

This is useful for analyzing database bottlenecks.