<p>I've noticed that a few Wordpress blogs have query statistics present in their footer that simply state the number of queries and the total time required to process them for the particular page, reading something like:</p>

<blockquote>
  <p>23 queries. 0.448 seconds</p>
</blockquote>

<p>I was wondering how this is accomplished.  Is it through the use of a particular Wordpress plug-in or perhaps from using some particular php function in the page's code?</p>

[{'answer_id': 14972, 'author': 'pix0r', 'author_id': 72, 'author_profile': 'https://Stackoverflow.com/users/72', 'pm_score': 5, 'selected': True, 'text': "<p>Try adding this to the bottom of the footer in your template:</p>\n\n<pre><code>&lt;?php echo $wpdb-&gt;num_queries; ?&gt; &lt;?php _e('queries'); ?&gt;. &lt;?php timer_stop(1); ?&gt; &lt;?php _e('seconds'); ?&gt;\n</code></pre>\n"}, {'answer_id': 15386, 'author': 'Carl Russmann', 'author_id': 1347, 'author_profile': 'https://Stackoverflow.com/users/1347', 'pm_score': 3, 'selected': False, 'text': '<p>To explain pix0r\'s code:</p>\n\n<ul>\n<li><p><code>$wpdb->num_queries</code> is the number of database queries.</p></li>\n<li><p><code>_e</code> is for localization:  <a href="http://faq.wordpress.net/view.php?p=50" rel="nofollow noreferrer">http://faq.wordpress.net/view.php?p=50</a></p></li>\n<li><p><code>timer_stop()</code> returns the amount of time taken to render the page: <br> <a href="http://codex.wordpress.org/Function_Reference/timer_stop" rel="nofollow noreferrer">http://codex.wordpress.org/Function_Reference/timer_stop</a></p></li>\n</ul>\n'}, {'answer_id': 23636709, 'author': 'Manoj H L', 'author_id': 2095317, 'author_profile': 'https://Stackoverflow.com/users/2095317', 'pm_score': 1, 'selected': False, 'text': '<p>wordpress has a easy solution now</p>\n\n<p>There is a function called <a href="http://codex.wordpress.org/Function_Reference/get_num_queries" rel="nofollow"><code>get_num_queries()</code></a> and as specified in other answers <a href="http://codex.wordpress.org/Function_Reference/timer_stop" rel="nofollow"><code>timer_stop()</code></a>.</p>\n\n<pre><code>&lt;?php echo get_num_queries(); _e(\' queries\'); ?&gt; in &lt;?php timer_stop(1); _e(\' seconds\'); ?&gt;&lt;/p&gt;\n</code></pre>\n\n<p><code>get_num_queries()</code> - returns the number of database queries during the WordPress execution and accepts no parameters </p>\n'}]
['https://Stackoverflow.com/questions/14873', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1339/']