In discussions around web performance optimization, the first things that come to mind are image optimization, minification, and edge caching. All good practices, but on a dynamic site or a high traffic one, the biggest hurdle to performance actually comes much closer to home - a cluttered database.
Whenever a page is loaded, WordPress needs to do several queries to get options, content, and data from your database. Should your database be cluttered with digital dust from many years ago, your Time to First Byte (TTFB) will be slow no matter how fast your CDN is.
Here are three database-level optimizations you should make today:
1. Putting Post Revisions on a Tighter Leash
By default, WordPress keeps every one of your revisions stored indefinitely. A 50-paragraph piece could easily end up filling 100 rows in the wp_posts table.
Control this by putting a line in your wp-config.php:
define( 'WP_POST_REVISIONS', 5 ); // Limits revisions to 5 per post
Nuking Expired Transients
Transients are a great way to cache API calls or heavy query results in the database. But once they expire, WordPress doesn't always clean them up automatically. Over time, millions of orphaned rows can collect in your wp_options table. Use a CLI command or a clean-up query to purge expired transients routinely.Cleaning the wp_commentmeta and wp_usermeta Tables
If you use plugins that track user behavior, store session tokens, or handle spam comments, these tables balloon quickly. Always ensure metadata is deleted when the parent comment or user is removed.
Database hygiene is just one piece of the puzzle, though. If you want a complete, step-by-step breakdown covering asset optimization, advanced caching strategies, and script management, check out the full guide:
🔗 Read the complete deep-dive: Comprehensive Guide to WordPress Performance Optimization
Let's discuss: What's your go-to hidden trick for squeezing a sub-100ms TTFB out of a legacy WordPress site? Drop your favorite optimization strategies below!
Top comments (0)