Optimizing your WordPress database tables in phpMyAdmin can reduce the size!

I’ve been going through phpmyadmin doing a little database optimization throughout my sites. One big surprise was massive overhead in the “wp_comments” table for this blog.

“Overhead” usually comes into play when you’ve deleted something, whether it’s a WordPress post/comments, Joomla articles, etc. It’s space that’s basically empty in the database (since the stuff’s been deleted), but is still taking up room.

In any case, I was shocked at how much was removed the first time – quite a few megabytes. Then again, this blog’s been going on for 3 years now. To give an idea as to how much can be cleaned up, after the first clear, I emptied the spam left by Akismet, and took a screenshot:

55 spam comments deleted in WordPress

As you can see, 55 comments were deleted. This is really just a couple days worth of spam caught by Akismet. Glad I don’t have to go through them all manually!


You’ll have to click the image for a larger version. On the right side though, you can see 814 KB of overhead. That’s almost a meg that was taken up by those 55 comments! I selected “Check All” from the bottom left, and then in the “with selected…” option list, chose “Optimize”.

Optimized wordpress table

And it’s clean. Dumping the spam really decreased the size of the table. Imagine thousands of comments over time. Yes, optimizing your databases on a regular basis is probably a smart thing to do.

Just make sure you back up first in case something goes wrong!