Loading Now

Optimize WordPress Database with WP-Optimize for Performance

Timeline of WordPress trackbacks and pingbacks

Recently, while accessing several WordPress dashboards, I noticed a concerning performance notification regarding the Site Health status:

“The site has 5,258 autoloaded options for a total of 3MB in size.”

If you encounter a similar alert or your website seems sluggish, it’s essential to take action—especially if you haven’t conducted a database clean-up recently. This isn’t purely aesthetic; it directly impacts your site’s performance and, more importantly, your SEO rankings.



The Impact of Database Bloat on Performance and SEO

Many users tend to focus solely on file-based caching solutions, such as CloudFlare or those provided by their hosting service, which are effective for static content. Unfortunately, the database is frequently neglected. Each time a page loads, WordPress conducts a query on the wp_options table to retrieve data labelled as “autoload.”

When this table becomes cluttered with unnecessary entries, outdated post revisions, expired transients, and remnants from uninstalled plugins, the resulting database query slows down significantly.

  • Issue: Sluggish database queries
  • Consequence: Increased Server response times (Time To First Byte)
  • SEO Repercussions: Google considers page speed an important ranking factor.
    • A slow TTFB may lead to penalties in search rankings alongside higher bounce rates

The silver lining? This challenge can be resolved quickly and safely using an excellent free plugin.

Introducing WP-Optimize: The Cleanup Tool (Free Version)

The most straightforward method I discovered for tackling this issue is by using the free version of WP-Optimize. I am in no way affiliated; I simply find it to be an effective tool for database optimisation.

IMPORTANT: Backup Your Database First!

Before you jump into database optimisation, ensure you create a complete backup of your database. Typically, I rely on my hosting provider’s backup wizard (like cPanel) for this procedure; it may take a while if your site is large, but it’s a critical safety measure in case anything unexpected occurs. Don’t miss this step.

Step-by-Step Database Optimisation

Once your backup is safe, follow these steps in your WP-Optimize dashboard:

  1. Deactivate Unused Plugins: Navigate to Plugins and disable any plugins you no longer actively use. Better yet, remove them entirely as they often leave residual data behind.
  2. Execute Basic Cleanups: In WP-Optimize, ensure the default settings for cleaning post revisions, deleted posts, and unapproved comments are selected.
  3. Select Essential Performance Fixes: To specifically address the warning regarding autoloaded options, check these two crucial boxes:
    • Remove expired transient options: Transients are temporary data stored in the database, and expired ones are simply clutter. Clearing them out significantly enhances performance.
    • Remove pingbacks and trackbacks: These legacy features of WordPress are often obsolete now. Deleting them helps in clearing up unnecessary data:
      • If available, also select options to remove orphaned Akismet data or similar items.
  4. Click “Run all selected optimisations”.


This process eliminates thousands of unnecessary entries, greatly reducing database size and speeding up queries.

The Transient Trick: Forcing an Immediate Update

After conducting the cleanup, I checked Tools > Site Health again, only to find the same warning. The number of autoloaded options remained unchanged!

Why, you ask? The Site Health check is a slow query, causing WordPress to cache the result in a transient for 24 hours. While your database is now clean, the status page still reflected the outdated data.

To rectify this situation without having to wait, follow this trick:

  1. Return to WP-Optimize.
  2. Scroll to the “Transient Options” section.
  3. Select the option: “Remove ALL transient options (not just expired)”.
  4. Click “Run optimisation”.

CAUTION: Although I usually advise against removing all transients, as it may temporarily slow your site down while your Server regenerates its cache, doing this right after a database cleanup is the quickest way to get an accurate Site Health check.

The end result? Upon rechecking Site Health, the warning had disappeared, and the count of autoloaded options had significantly decreased (it dropped to around 2,100 in my case).

Summary

Maintaining a clean database results in a faster website, which in turn contributes to better SEO ranking. Problem solved!