If you are a WordPress user, you will be very familiar with the internal system that saves revisions of your posts during the drafting process:
This has come in very handy….never. It’s never come in handy, ever. I’m sure one day it will save the day and I will regret this, but for now it is just annoying.
Not only that, they take up valuable database site, and can even lead to a slower site speed and poor performance.
What shall we do? Download a plugin?
Not even close. Although there are some database plugin optimzation plugins, today we are going to jump under the hood of WordPress, and run an SQL database query.
Sounds hard, huh?
Well it isn’t. It’s actually really easy, pretty much anyone who can click on a few icons and paste some code can do it.
Ok, how do I do this?
Start by going to your hosting control panel, most likely cpanel.
Locate the “phpmyadmin” module. This module is for the sole purpose of managing sql databases.
Next, find the database that you want to optimize by clicking on it on the right hand side. Once you’ve located the database, go to “SQL” at the top.
(note, always backup your database before performing any SQL database maintenance. )
You will now be presented with a text-area box where you can type. Paste this code:
DELETE FROM wp_posts WHERE post_type = “revision”;
and hit GO!
If you are successful, you’ll see something that looks like this:
This process should have taken you about 2 minutes but will leave you feeling fresh and clean. Don’t you feel better that 5000 rows have been deleted from your database.
Your website thanks you.