Audio Visual Junkie

Fix WordPress MySQL out of memory error

Lately this blog has been suffering from MySQL out of memory error messages which got worse as the days went by. Sometimes Is could not post stories, or my sidebar would not load. Other times I could not load the admin area, or my site went down entirely. After doing a bit of tracing and research I was shocked to discover that my wp_options table had almost 2,000 records in it. As I skimmed through the records I saw that majority of it had rss_ to it, which led me to research on WordPress’ RSS caching mechanism.

So, I did some more digging until I came across lildude’s explanation of WordPress’ autoload functionality, which defaults to yes, causing it to bloat the $GLOBALS variable with all the crap our lovely plugins dump into the wp_options table. Finally I came across jayrocas’ post on the WordPress support forums on how his blog database had a bunch of entries whose option_name looked something like “rss_f07b6018d7bc77b2520b5ec4296f3e66_ts”. After reading the community’s response, I decided to delete all 1,325 rows that started with “rss_”. The query I used was:

DELETE FROM `wp_options` WHERE `option_name` LIKE “rss_%”

Like magic, my blog loaded without any more hiccups. Reloading the home page immediately after cleaning up the database results in 8 new “rss_” entries. I can only think of two RSS feeds that my homepage pulls from (Flickr and Last.FM) so I’m not sure where the other 6 is coming from. Looking at the database, it appears that there is a duplicate entry for Flickr and Last.FM, and there is 3 entries with the same option_name hash “rss_89613d9a050aad8af096de3c8dfa83bd_ts” and option_value of “1224690561″. I don’t know what’s causing the duplication, or what the bogus triplicate entry is. I have no intention of doing so. Right now, I’m content with a running blog. I’ll just do a database clean up every now whenever necessary.

I am still trying to see if the CommentLuv plugin had anything to do with bloating my wp_options table. There is a huge chance that it does, but I love this plugin so I will just try to upgrade it when I’m done with this post.

Finally, I also installed the Clean Options plugin, which searches for and removes orphaned entries in the wp_options table. Cool. But is there no select all / remove all option? I can’t imagine having to place a check on all 1.7k rss_ entries when it takes me less than a minute to login to PhpMyAdmin and execute that query I listed above. Will this plugin be of any use? I’ll just keep it installed – just in case.


Posted

in

by

Comments

2 responses to “Fix WordPress MySQL out of memory error”