WordPress database clean up

I tried to upgrade my blog to WordPress 2.5 days ago so I had the chance to check my MySQL database closely in PhpMyadmin. And I was astonished because the size of my database is over 4MB! That’s huge for a small scale blog. When I checked the tables in the database, I found there are two tables were uncommonly large: wp_comments and wp_options, both are over 1MB or more. When I checked them out by browsing their contents, I found that in the wp_comments table, there are tons of spam comments (marked “spam” in the “comment_approved” field). In the wp_options table, there are lots of unused options from uninstalled plugins left and there are lots of items begin with rss_. With a simple search on the net, I learned those spam comments and trackbacks are stored in the wp_comments table even though they are marked as spam and not posted to the blog. And for those options with rss_ prefix, they are RSS feeds contents used in WordPress dashboard, etc. So basically I don’t need them, especially when they make the database so fat and make the blog significantly slow.

To clean them, I just simply delete the spam comments and trackbacks in wp_comments table and rss_ items in wp_options table. The SQL query is like this:

DELETE FROM `wp_comments` WHERE `comment_approved` = 'spam'

After the clean up, my database is just about 900KB, what a difference! If you are not comfortable to edit in PhpMyadmin directly (like regedit in Windows), fortunately there are some plugins out there do the job well. CJD Spam Nuke and Clear Options are two of them and very easy to use. The latest Akismet plugin also can delete the spams from database manually or automatically.

Related posts

Leave a comment

1 Comment.

  1. Thanks for the tip. I wandered into WordPress thing it was just a WUSIWUG blog site and quickly learned how powerful it was. I’ll check out those plugins.

Leave a Reply to Nathan


[ Ctrl + Enter ]