Wordpress: how to trim your wp_options table

In my line of work I am exposed to various Wordpress installations – different plug-in sets, different themes, various amount of content – so, I have my fair share of troubleshooting Wordpress performance issues related to almost anything.

Sometimes you can find single Wordpress site getting extremely slow with the time – page loading takes tens of seconds even though you did not install anything new and and number of visitors is not surging.
One of the possible reasons for that is that your wp_options table grew too big. The SQL query in the pictured screenshot allows to see what is going on with wp_options:

Depending on the output you can judge how bloated your wp_options table has become – if the number are in range of 4-5 digits that could could be the source problem – keep in mind that rows with autoload are queried on each page request. Another good indication would be lots if locked queries running on wp_options table listed in mysql process list.

What can be done about it? Basically it depends on what kind of records you will find filling the wp_options table.
Deleting _site_transient* and _transient* rows considered to be pretty safe – it’s just cached queries results that will be recreated as needed and supposed to be garbage collected but sometimes just doesn’t.

Also NextGen Gallery is known to create a lot of records in wp_options table with the names like _nextgen* that are fairly safe to remove.
Also look for leftover records from uninstalled plugins – not all of them are cleaning data before deletion.

Would be a good idea to backup the table before doing any surgery just to be on the safe side.
Happy trimming.

Share Button

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">