8 Tips to Have a Fast and Clean WordPress Database
WordPress has consolidated its position as the go-to CMS for all projects. Whether it is a corporate website or a professional portfolio, WordPress provides the perfect platform and the right set of tools to get the job done.
An important reason for this unshakable position is the simplicity of using WordPress. Even a person with mediocre tech skills could set up a WordPress powered blog. The day-to-day management is a matter of handling a few easy things.
Fast and Clean WordPress Database
However, like every great thing out there, things are not that rosy with WordPress. Over time, the users complain of the platform slowing down. This is also reflected in the page load speed of the blog as well. The clutter in the database is the accumulation of junk comments, blog revisions and other items that bog down the performance of the website.
Quickly Clean a WordPress Database
Before getting into details of how to maintain your database, let us show you how to quickly clean your WordPress database. Now don’t worry about writing code and related technicalities because there’s a simple plugin that will do everything for you!
1. Install free WP-Sweep plugin from the repository
2. After activating, go to Tools > Sweep
On this page, the plugin will show a detailed analysis of your database. It will show you the clutter, and what can be done to optimize it. You can clean section by section or quickly scroll down and click the button to clean the entire database.
Please note that although the plugins are often safe to use, there might be times when the plugin will delete something it shouldn’t. So before actually hitting the button, please make sure that you have a backup of your database.
If you want to make sure that your site is secured and optimized, you should take a look at Security Ninja’s Database Optimizer module.
8 Ways to a Clutter-free Database
Obviously, a clean and clutter-free database is essential to the smooth and hassle-free performance of your WordPress website. The problem is that many users treat database cleanup as a one-time activity. Instead, experts recommend that it should be a regularly scheduled activity.
So, here are eight tips to maintain a clutter-free database.
Working with a database is a risky business and there is always a chance that something might go wrong. In all cases, you should have a recent version of the database information to deal with problems. So the first order of the business is to backup your database on a local or cloud storage platform.
2) Regular Dusting Off of the Database
Users often install plugins and themes and then forget about it. As a result, all this junk accumulates in the database. In many cases, these plugins and themes leave additional references to the files in the database that add to the load time of the information from the database. Thus, prompt cleaning of the database after installation is the best way to a clean database.
3) Use SQL
SQL is one of the most important ways of improving the health of the database. The best thing to do is to use phpMyAdmin and select the database you wish to work with. phpMyAdmin is a great tool for managing database clutter.
4) Clean up Zombie Tables
Plugins and themes often add tables to manage their information and performance. The problem arises when the users add too many plugins and themes to the websites. As a result, things get very cluttered in the database because of a large number of tables that are not in use anymore.
You need to make sure that these tables are deleted once you have uninstalled the plugin.
5) Bust Spam!
In the context of WordPress, anything that is deadweight to the performance of the website is spam. On a WordPress website, spam comes in several shapes including comments, posts, and related content items.
Since the bulk of the WordPress spam is the in the comments section, deleting spam comments generally lighten up the database. Use the following SQL query to clean out the database:
DELETE FROM wp_comments WHERE comment_approved = ‘spam’;
You can delete the spam manually from the WordPress dashboard or schedule the above query at the regular interval to clear the spam automatically.
6) Tag ‘em Carefully
While posting a particular blog, users often use several tags. Since there is no practical restrictions on the number and usage of tags, WordPress users often go tag-crazy and create tags for individual posts that are never reused. As a result, the tags add a significant drag on the WordPress database.
The following query given below helps in this scenario:
DELETE FROM wp_terms wt INNER JOIN wp_term_taxonomy wtt ON wt.term_id = wtt.term_id WHERE wtt.taxonomy = ‘post_tag’ AND wtt.count = 0;
7) Adieu, Pingbacks
Pingbacks often bog down the database’s performance of a WordPress website. Since these are not very visible, users often overlook their addition to the database. Over time, the pingbacks convert into junk that needs to be cleaned out. Use the following query to clean out pingbacks:
DELETE FROM wp_comments WHERE comment_type = ‘pingback’;
Again, you can run the above query at a predefined interval to clear out pingbacks automatically.
8) Use, Revise and Throw out
Websites that are in the business for a while often have a serious issue. The number of posts revisions and drafts is often high enough to impact the performance of the website. WordPress highlights this issue and prompt users to remove this junk from the database.
The best way to deal with this issue is to remove all drafts and revisions as soon as a post is published. In fact, the cleanup and removal of drafts and revisions should be a weekly activity so that the clutter doesn’t damage the performance of the website.
Subscribe to Get a FREE WordPress Ebook Right in Your Inbox
WPblog provides the complete guide to launch your WordPress website completely FREE!
Moeez is ‘The’ blogger in charge of WPblog. He loves to interact and learn about WordPress with people in the WordPress community. Outside his work life, Moeez spends time hanging out with his friends, playing Xbox and watching football on the weekends. You can get in touch with him at moeez[at]wpblog.com.