How To Disable Post Revisions in WordPress

Since WordPress 2.6, everytime you save a post, it is saved as a revision. All previous revisions are also saved. So, 10 revisions to a post will end up with 11 posts in the database. If you don’t need this revision history, and want to slim your database, add this code to your functions.php file:

define('WP_POST_REVISIONS', false);

Now, if you database is already full of previous revision, and you want to delete those form the database, also run this sql statement on the database:

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'