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.
8 Responses to Fix Wordpress MySQL out of memory error
Andy Bailey
October 23rd, 2008 at 1:25 am
it is true that the old version of commentluv (way back) used to do this, I changed the code quite a while ago so it wouldn’t do this any more.
I’m glad you managed to clear up your problem, the latest version of CommentLuv is much better and wont cause any database woes!
Andy Bailey’s last blog post..BRING ON THE TRUMPETS!
Dennison Uy
October 23rd, 2008 at 5:41 pm
Andy
Thanks for dropping by my blog! I couldn’t get CommentLuv v2.1 to run though. I did follow instructions (deactivate, upload, activate, check settings). I kinda felt disappointed – I was so excited to use the new version!
I reverted back to version 0.96 for now. Any ideas how to fix?
Kevin Phoenix
October 24th, 2008 at 6:54 pm
Thanks for the post… I’ll look up the “Clean Options” plug in – could be very useful.
markez linda
March 8th, 2009 at 4:25 pm
This is nice. Thank you
markez linda’s last blog post..Butterfly brushes
Mittineague
March 28th, 2009 at 10:42 am
Please note that the wp_options table also contains some WordPress Core options that begin with “rss_” i.e.
‘rss_excerpt_length’
‘rss_use_excerpt’
‘rss_language’
Not having these options may result in your blog’s feeds being not valid due to the missing “language”. And if you intend your feeds to be excerpts, they may not be.
There have been many changes with the Clean Options plugin since October (including the addition of a select all) and the current version will replace the above options if they are missing. I encourage you to give it a try and please feel free to leave comments and suggestions. Thanks.
Mittineague’s last blog post..There are 2 plants in blossom on March the 27th.
Dennison Uy
March 28th, 2009 at 4:45 pm
Hey Mittineague, thanks for dropping by! I think it’s awesome that the Clean Options plugin is still in active development. Keep it up!
RaiulBaztepo
March 29th, 2009 at 6:30 am
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language
See you!
Your, Raiul Baztepo
Wouha
February 16th, 2010 at 10:48 pm
Hello, i have save an image from the web and try to put it on my blog. My image was 60k and i see this message: Fatal error: Out of memory (allocated xxxx) (tried to allocate xxxx bytes) in /web/sites/xxx/x/xx/xxx/public/www/wp-includes/wp-db.php on line xxx
First i search for the same error on google, find this post here. For me, my problem was solved easyly.
I just open my image in paint.net (image editor) and i see the image was really big in pixel. So i resize it like 1000×600 pixel and i success to put the image on my blog.
I cannot tell if that can help someone, but i hope.
Good luck
(sorry for my poor english, this is not my native language)