How To Clean Your Options Table For Better WordPress Performance

Did you know that there’s a really good chance that your WordPress database is still cluttered with the ghosts of plugins you no longer use? Here’s how to see if your Options table is bloated… and how to clean it.

Did you know that there’s a really good chance that your WordPress database is still cluttered with the ghosts of plugins you no longer use?

Not only that, some of those options are automatically loaded up on every page view of your site. Clogging things up. Taking up more memory. All for no reason whatsoever.

This can adversely affect the performance of your WordPress site.

So, let’s talk about how to find out what is going on with your site and what you can do about it.

What is the wp_options Table?

Your WordPress database has a bunch of tables in it. You can think of tables just like you would a sheet in an Excel spreadsheet. Your database has a bunch of tables in it.

One of those tables is called wp_options. This is one of the default tables that are part of WordPress.

The wp_options table is used to store settings. It could be settings from WordPress itself or from any of the plugins that have ever existed on your site.

There are 4 fields in this table and they are:

  • option_id – This is just an internal database ID. No big deal.
  • option_name – This is the name of the setting. It is using an internal name isn’t usually seen by end users, but the underlying code knows to look for it.
  • option_value – This is the actual value of the setting. In some cases it is simple, but in other cases this can be a massive amount of data.
  • autoload – If set to “yes”, this means the option is automatically queried and loaded up on every page of your WordPress site.

Over time, this options table can end up with a lot of entries. At the time of this writing, I checked my own options table for this very site and I have 3295 entries in my wp_options table.

But, merely having a lot of entries isn’t a problem. The problem is the ones set to be autoloaded.

The Problems With Autoloaded Options

As stated before, when an option is set to autoload, it will be loaded automatically on every page view.

Autoload defaults to “yes”. This is supposed to be convenient… and it is. However, not all options really need to be autoloaded. Sometimes, themes and plugins are just using wp_options as a storage place for stuff, but it isn’t information that needs to be loaded up all the time.

It is up to the plugin/theme developer to set the autoload to “no”. Since it defaults to “yes”, this means that clumsy developers may not actually take proper control over it for performance reasons.

For instance, what if a contact form plugin was storing settings in the options table and it was autoloaded? Those settings are only needed when the form is actually showing up on the screen. But, if all that stuff is set to autoload, it will load up everywhere.

But, the problem gets a little worse. And that’s because…

  • Data is being autoloaded when it doesn’t need to be.
  • Most plugins do NOT remove settings from the options table when they are deactivated and uninstalled. So, that leftover data sits there and continues to be autoloaded even though it is basically “ghost” data.
  • Many plugins/themes are overusing the wp_options table by storing all kinds of stuff in there rather than using their own custom tables. So, the table ends up getting overused.

Let Somebody Else Deal With The “Tech Stuff”

With WP Concierge, you no longer have to deal with the tech stuff. We’ll provide all the software, maintain it for you, and provide personal support along the way. All included… and you’ll be on a first name basis with your “web guy”

How Much Autoloaded Data Is Too Much?

So, here’s the thing…

The MySQL database (the kind of database WordPress uses) is pretty fast. So, even if your autoloaded options is rather bloated, there’s a decent chance it might be hard to tell. Especially if your site is using object caching, this data is stored in the server memory and things can be rather snappy.

But, it does cause your site to have a bigger memory footprint. So, it is better to try to clean this stuff up somewhat.

If you can get a total size of your autoloaded data to be under 1MB, you’re in pretty good shape. If it gets bigger than that, you may want to take a little time to clean things up. And if you’re in a situation where you’re seeing autoloaded data getting up to 8-10MB or bigger, then your site is definitely bogged down and this is a situation you should handle.

How To Check How Big Your Autoloaded Data Is

A fairly easy way to do this is to run a query directly on your WordPress database. To do that, open up the database manager from inside your WordPress host. In most cases, that will be PHPMyAdmin.

Then, you’ll want to run the following SQL query:

SELECT SUM(LENGTH(option_value)) as autoload_size FROM wp_options WHERE autoload='yes';

Note that if your database is using a prefix on your table names, you may need to alter that. The default prefix is “wp_”, which makes the table name “wp_options”. If your’s is using a different prefix, change the query.

Now what you’re going to get back will be the total number of bytes. For instance, when I ran this query on my own site, I got the following result:

So that’s a total size of 1092584 bytes. There are 1024 bytes in a KB and 1024 KBs in a MB. So, basically, my total autoloaded data size is about 1.09MB.

I wouldn’t spend much time trying to clean up a 1.09MB data size unless I just felt like being a perfectionist. 🤪 This data size is barely going to be noticable in most situations.

Want an easier way than PHPMyAdmin and raw queries? Check out a simple plugin called Autoload Checker. This plug will give you the total size of your autoloaded data as well as the top 20 options being autoloaded. Here’s what mine looks like:

In my case, looks like the RankMath SEO plugin is the biggest source of autoloaded data. But, I actually use this plugin so that’s fine.

Another useful plugin is Advanced DB Cleaner. This one is free, but they have a PRO version which adds some extra functionality.

This plugin has a lot of uses and does far more than just looking at your WordPress options. But, one of the tabs in the plugin is for directly viewing the data in your options table.

You can search, view and sort everything in your options table. You can sort by size and filter the autoloaded options and therefore find the ones taking up most of the space.

With the PRO version of the plugin, you can also run a scan on all the options and the plugin will do it’s best to determine whether they’re being used and what plugin is using them. It isn’t 100% accurate, but it is still a help.

How To Tell What Those Options Are For

So, when you’re looking at that list of weird option names, how do you know what they’re used for?

If you’re running the PRO version of Advanced DB Cleaner, the automatic categorization function might help you figure it out.

But, without a tool like that (and even with a tool like that), one of the best options is to run a Google search.

In many cases, you can tell by the option name. Most of the time, the option names use prefixes which will give away what it is used for. For instance, my biggest option in the database is “elementor_remote_info_library”. You can tell right from the name that this is associated with the Elementor page builder. I no longer use Elementor on this site so I know I don’t need it anymore. That said, this option is not autoloaded so it has no effect on site performance. I could keep it there in case I ever re-install Elementor, but it doesn’t really matter.

Between the option name and some Google searching, you ca usually get a good idea what the option is for. In some cases, you can check out the data itself (the option value) and figure out what it was for based on what you see in there.

Keep in mind, when looking at the option values, often it will be what is called a serialized array. An array is basically a format for data. When you serialize an array, it puts it into a plain-text format so that it can be stored in a database. Looking at that text is going to look like a bunch of gibberish, but throughout it you will see values stored in that array. Often, you can figure it out from there.

How To Clean Out The Options Table

First off, always run a database backup before doing anything.

Deleting options from this table means you’re messing with the database directly. And, if you delete something that is actually necessary, you could end up breaking something. So, make sure it is backed up and you can restore if you screw it up.

The easiest way to take action on your options table is, once again, the Advanced DB Cleaner plugin. This will allow you to take action on this table from within WordPress and using a user-friendly interface. This is far less overwhelming than running queries with PHPMyAdmin.

You’ve got two main options here on your options:

  • Delete them. If you know for sure they are not needed anymore, you can just delete the options entries from your database.
  • Set Autoload to “No”. You can keep the data in your options table, but make it so it won’t load up automatically anymore.

So, as you search and sort and research the options in your table, you can just take one of the above actions. In most cases, deleting is the better option. And Advanced DB Cleaner makes it easy to delete these entries.

Seeing as a lot of the stored options use naming conventions that give away what they’re for, many times you can run a search for that name, fetch all options for one single plugin, and delete them all at once.

Advanced DB Cleaner PRO makes it easy to run searches like that. But, if you’re trying to do this manually in PHPMyAdmin, here’s a query to help:

SELECT * 
FROM `wp_options` 
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%jetpack%'

That query would find any autoloaded entries with an option_name that contains the string “jetpack”. In this case, it would be finding data from the Jetpack plugin.

When you run that query, you could then select all rows and delete the data in PHPMyAdmin. Or, you could do it directly using a query like:

DELETE
FROM `wp_options` 
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%jetpack%'

Part Of Overall WordPress Performance

So, after all that… just how much time should you spend on this?

Don’t try to seek perfection on this. It isn’t worth it. If you let your OCD kick in and spend multiple hours trying to delete every single unused option from the wp_options table, you WILL be wasting your time.

Truth is, the performance impact of this is fairly minimal unless you’ve got an extraordinarily bloated table. It does happen from time to time and is most common when a site has a history of a lot of plugins being tried over time – and especially poorly coded plugins.

So, the first thing I would do is find out just how big your autoloaded options is. If it is anything around 1MB or less, just move on. In my case, I was just a bit over 1MB and it just isn’t worth a lot of time on this.

If you find autoloaded data is bigger than 1MB, then look for the largest offenders. Remove the big ones and see what you can do to get your total under 1MB.

Overall, database optimization can indeed help the performance of your site. And removing old options is part of that optimization.

Whether the impact on performance will be measurable really depends on your particular site.

And, of course, there is quite a bit more that goes into overall WordPress site performance. It is a pretty holistic thing and the database is just part of it.

Let Somebody Else Deal With The “Tech Stuff”

With WP Concierge, you no longer have to deal with the tech stuff. We’ll provide all the software, maintain it for you, and provide personal support along the way. All included… and you’ll be on a first name basis with your “web guy”


Got A Question?

Have a question about this article? Need some help with this topic (or anything else)? Send it in and I’ll get back to you personally. I think that’s better than a blog comment. 😇

Question – Lead Form