How to Optimise a WordPress Database for Better Performance

Your WordPress Database Is Full of Junk. Cleaning It Improves Speed Immediately.

Every time you save a draft, WordPress creates a revision. Every spam comment marked as spam stays in the database. Every deleted plugin leaves behind database tables. Over months and years, your WordPress database accumulates megabytes of useless data that slow down every query. Cleaning it can improve page load times by 10-30% with no visible change to your site.

“A bloated WordPress database is like a filing cabinet stuffed with old paperwork. Finding anything takes longer. Cleaning it out makes everything faster.”

The Database Optimisation Process

1. Delete post revisions. Use WP-Optimize or Advanced Database Cleaner. A site with 200 posts can easily have 2,000 revisions. 2. Delete spam and trashed comments. These sit in the database forever unless manually removed. 3. Remove transient options. Expired transients are temporary data that WordPress often fails to clean up. 4. Delete orphaned metadata. Post meta, comment meta, and user meta that no longer have a parent record. 5. Optimise database tables. This reorganises table data for faster queries — similar to defragmenting a hard drive. 6. Limit revisions. Add define('WP_POST_REVISIONS', 3); to wp-config.php to keep only the last 3 revisions of each post. 7. Schedule automatic cleanups. Set WP-Optimize to run weekly. The database stays clean without manual intervention.

Before You Touch the Database

Take a full backup. Database operations, if done incorrectly, can corrupt your site. A backup ensures you can restore if anything goes wrong. For professional database optimisation, see our WordPress Services page.

“Database optimisation is the most overlooked performance improvement for WordPress. Ten minutes of cleanup can produce the same speed gain as hours of code optimisation.”