What's the method to show database performance metrics in WordPress footer?

I keep seeing WordPress websites that have performance info at the bottom of their pages. It shows stuff like how many database queries ran and how long it took to load everything. For example, it might say something like 15 queries in 0.312 seconds.

I’m curious about how to add this feature to my own site. Is there a specific plugin that does this or do I need to add some custom PHP code to my theme files? I’d really like to monitor my site’s performance this way but I’m not sure where to start. Any suggestions would be helpful!

WordPress has built-in functions that’ll show you those metrics. Just drop a couple lines in your theme’s footer.php file. Use <?php echo get_num_queries(); ?> for query count and <?php echo timer_stop(0); ?> for execution time. I’ve used this setup for years on client sites - works great across different hosts. The timer shows page generation time, get_num_queries counts database queries during page load. Wrap them in a paragraph tag and style however you want. No plugins needed, and you’re not adding any bloat to your site.

Query Monitor’s your best bet if you want something more comprehensive than basic code snippets. I’ve used it for dev work and it shows detailed performance data - database queries, PHP errors, page load times, the works. You can set it to display summary stats in the footer for logged-in users only, so visitors won’t see the technical stuff. It breaks down queries by plugin and theme too, making it easy to spot performance bottlenecks. Way more useful than basic WordPress functions and you don’t have to mess with theme files.

you can also just flip on wp debug mode real quick. drop define('WP_DEBUG', true); into wp-config.php and you’ll get query info at the bottom of your pages. not as slick as query monitor, but it works for quick debugging. just don’t forget to turn it off on production - nobody wants to see that mess.