Did you know that each time you save a draft post to your WordPress blog, the mySQL database stores a record of that post?
Your WordPress database also contains records of each update you make to published posts, and all those spam comments you thought you were deleting when you clicked the ‘Empty Spam' button? Each one of those was also saved to your mySQL database.
Now, while a very large database won't affect your blog's performance speed-wise, it does increase the potential for mySQL database errors, so it is best to get rid of all that useless junk.
If you like to tinker with the inner workings of WordPress, you can modify your wp-config.php file to automate the junk removal.
I however prefer to use WP-Optimize, a free WordPress plugin which completely removes:
- WordPress Autosaves
- Deleted spam comments
- Trashed comments
- Trackbacks and pingbacks
- Comments which not been approved for a set period of time
- Post revisions
- and more…
The plugin will also inform you how much space can be saved, how much is saved and exactly how many of each type of trash was removed from the database after the process is complete — as shown in the following screenshots.
WP-Optimize also allows you to schedule automatic database optimization with the option to retain data for a selected number of weeks and remove any garbage accumulated before that period.
Comments, questions or suggestions? Please leave a comment below!