Remove WordPress Post Revisions for Database Optimization
Ever since WordPress introduced autosaving and revision control features, larger blogs have seen a significant increase in the size of their databases. If your WordPress installation has slowed dramatically or you are simply looking to optimize your database by removing countless records you'll never end up actually needing, run the following query on your WordPress database:
delete from wp_posts where post_type = "revision";
If you're wondering how to use this query, it may not be the best idea to do it yourself and you should probably have your database administrator help you out with this. Then again, if you have a DBA you probably aren't reading this post so here's how you use it.
Using phpMyAdmin, SQLyog, Sequel Pro or another MySQL GUI tool, login to MySQL and select the appropriate WordPress database (if you have more than one WordPress database, be very careful making sure you are selecting the database connected to the blog you are working on). Then run the query from above and you're done. For example, if you're using phpMyAdmin, click on "SQL" from the top menu, paste in the query and click, "Go."
If you do not have access to a MySQL GUI tool, you can do this from a Unix shell such as Terminal. To login to MySQL from Terminal, run the following command:
mysql -u <username> -p<password> <database>
An sample command for the above command example is:
mysql -u root -pyourpassword wordpress
Then, simply copy the query provided at the start of this post into the command line (as depicted below):
mysql> delete from wp_posts where post_type = "revision";
Hit, "return" and you're done!