Are you struggling with slow site loading times?
Just a few extra seconds can make a big difference. For every additional second it takes your site to load, your page abandon rate rises. About half of your visitors will expect it to load in 2 seconds or less, according to KISSmetrics.
If it doesn’t, they’re hitting that back button.
Need an easy way to shave a few seconds off your load time?
If your WordPress site’s been around for longer than a few months, cleaning up your database could boost those load times and decrease your bounce rate.
Why Does Your WordPress Database Need Cleaning?
WordPress software, as you probably know, uses PHP and MySQL. PHP is a programming language that’s used in WordPress to access and display the information stored in a MySQL database.
For every WordPress installation, there’s a MySQL database behind it. Your MySQL database contains all the information about your WordPress website, from your website name to your post dates.
Your MySQL database organizes all that information into separate tables. There’s a table for your options and settings, a table for your comments, a table for your post content, etc. Every bit of data, like your blog title, author bio, and each commenter’s name, are stored in those tables in your database.
A fresh WordPress installation will have 11 tables. And sometimes when you install new themes or plugins they create new tables in your database to store the information they need.
If you’ve ever changed themes or uninstalled plugins, they may have left information lying around your database that’s just taking up space. Your database also contains a lot of old information you don’t need anymore, like every single revision or draft version of your posts. It also keeps all comments, including pingbacks and spam.
That’s why, as your WordPress website grows and ages, it accumulates a lot of information in your database. All that information in your database is not only taking up valuable space, but can slow down your website, because it takes longer for your server to find and retrieve the data it needs.
By cleaning up and optimizing your WordPress database, you can shave valuable seconds off your site loading time.
Plus, getting rid of all that extraneous data will give you more storage space, in case your hosting plan is very limited.
Now that you know why it’s important to clean up your WordPress database, we’ll get into how exactly to do that.
Backup Your Database!
Like I said, your database contains all the information needed to run your site.
That means that messing with your database can be dangerous. Delete just one wrong thing, and you could end up breaking your website completely.
That’s why it’s so important to make sure you have a working backup and know how to restore your site before you start messing with your database.
Check out these suggested backup plugins, and be sure to backup your database before you move on to the next section.
Go backup your database now! Don’t worry, I’ll wait.
Do You Really Need a Plugin to Clean up Your Database?
It’s understandable that you might be a little leery of installing another plugin on your site, especially after I talked about how plugins often add more extra information to your database.
It’s definitely possible to clean up your database without a plugin, if you know what you’re doing.
If you log in to your account hosting account’s cPanel, there should be a tool there called PHPMyAdmin. Using PHPMyAdmin, you can directly view and manage all your MySQL databases.
Under the “Table” column is the name of each table in your database. The “size” column shows how much space that table takes up.
You might notice that your “wp_commentmeta” table is the largest. This is pretty common, since that’s where WordPress stores all your comment history, including spam and other data you just don’t need.
As you can see, PHPMyAdmin looks a little intimidating if you’re not familiar with managing databases. It can be hard to tell exactly what each table is for, and it’s easy to make an irreversible mistake. That “Drop” link, for example, will irreversibly delete that table and all the data stored in it.
If you did want to clean up your database using just PHPMyAdmin, you’d have to go table by table, identifying the specific data you want to delete, and entering MySQL commands to delete that data. Unless you’re very familiar with MySQL, I wouldn’t recommend trying this. It’s just too easy to delete the wrong thing.
(However, you CAN optimize your tables easily in PHPMyAdmin. Just click on the “Structure” tab, and check the checkboxes next to all the tables you want to optimize. Under the list of tables, you’ll see a dropdown box. Choose the option “Optimize Tables,” and your database will be optimized!)
That’s why I like using a plugin to clean up my database. Plugins can scan and evaluate your database and tell you what data is needed, and what can be deleted. Many of them will warn you about features or tools that can potentially break your site. They’re much more user-friendly.
And, if you’re concerned about a plugin taking up space, you don’t have to leave it installed. You can just let it do its thing, and then delete it until you need another cleaning.
Top 3 Plugins to Clean Your WordPress Database
WP-Optimize is a highly-rated plugin: 4.7 out of 5 stars, with hundreds of reviews. In just one click you can use WP-Optimize to clean up and optimize your database. It can clean up post revisions, spam comments, and lots of other extraneous information. You can also set it to automatically clean your database once a week.
After installing, click on the new menu option “WP-Optimize.” There are no sub-menus; everything you can do is right there.
As you can see above, it’s pretty user-friendly even if you’re new to database management, since all the potentially dangerous options are marked in bright red with a warning.
If you click on the “TABLES” link at the top, you’ll see a list of your database’s tables, along with an analysis of how much space they’re using up. There’s also a total sum of your database space, and how much space you could save by optimizing.
Under “SETTINGS,” you can schedule automatic database cleanups to run weekly, biweekly, or monthly.
This plugin does NOT have a backup feature included, so please be sure to backup your database with another method before you install this plugin.
WP Clean Up Optimizer
WP Clean Up Optimizer cleans up old information from your database, and also has optimize and repair options. This plugin cleans up post revisions, drafts, comments, pingbacks, and orphaned information like post meta.
There’s also a Pro version with a lot more features and premium support. With the pro version You can also schedule cleanups to run automatically at any interval you choose, from daily to yearly.
To use WP Clean Up Optimizer, install the plugin and navigate to the new “WP Clean Up Optimizer” menu option. Right on the dashboard, you’ll see some items you can empty out of your database:
You can then click the “DB Optimizer” tab in the Dashboard to optimize individual tables. Tables that are integral to WordPress’s function are highlighted in red to prevent you from unintentionally breaking your site.
Unfortunately, a lot of the features are disabled in the free version. But if the automatic scheduler and other features are worth it to you, you can pick up the premium version starting at a one-time fee of £8, or about $12.50.
With just over a million downloads and rated 4 out of 5 stars, WP DBManager is one of the more popular database cleaning plugins.
WP DBManager has features to completely manage your WordPress database. Besides cleaning it, you can also backup, restore, repair, and optimize your database. You can also schedule an automatic backup/repair/optimize and email yourself the backup file.
After you install and activate this plugin, you’ll see a the new “Database” menu option. You can backup your site by clicking on Database > Backup DB.
After you backup your database, you can go to Database > Optimize and choose which tables you’d like to optimize.
There’s also a menu option called “Empty/Drop Tables.” Be very careful in this menu, and don’t use it unless your 100% sure of what you’re doing. In MySQL, to “drop” a table means to delete it forever. There’s a tiny warning at the bottom of the page, but it’s not very noticeable.
Under Database > DB Options, you can schedule automatic backup, optimization, and repair of your databases.
Backup, Then Get to Cleaning!
Don’t forget to backup your database before trying one of the plugins above, and let us know how it goes!
How do you keep your database clean and running smoothly? Give your suggestions below!