Boosting up the page loading speed can be regarded as a common practice for all the WordPress webmasters. After all, it is not a secret that search engines put massive importance into the website speed at present, meaning that the faster your website is, the higher ranking your webpages may get.
Among all the methods used for the optimization of WordPress page loading, the reduction of database size is a truly effective one, reducing the page loading time greatly. After all, with the growing of your WordPress site, your database must contain some unused entries, tables and records that negatively affect your website running. In this case, having the database size reduced and cleaned up timely is essential to keep your site fast.
In the following, we have listed some useful tips about how to reduce the size of WordPress database easily.
Tip 1: remove WordPress revisions
WordPress has a default feature named as revision, which makes the WordPress database unnecessarily large as your website grows.
This feature is added since WordPress version 2.6. With it, all the changes you make on your posts and drafts will be stored every two minutes as revisions. With them, you can revert back to the older versions of your posts or check some earlier drafts. However, as these auto-saved files are stored as separate entries in your database and WordPress does not set any restrictions on the number of revisions for each post, this feature simply enlarges your database greatly. Sometimes when you are working on a lengthy post, this feature can lead to tens of revisions being stored.
In this case, having your revisions cleared regularly is important. This post simply tells you how to carry out this practice using the Better Delete Revision plugin.
Besides, you can also limit the number of revisions that are saved for each post. For this, you can add the following code into your wp-config.php file. The character X refers to the limit number.
define( 'WP_POST_REVISIONS', X );
Tip 2: remove spam comments
As time goes, you may receive a lot of spam comments from both humans and robots. These spam messages may take up a large number of rows in your wp_comment table. Therefore, you need to clear them up on a regular basis.
Among all the tools to prevent spam comments, we highly recommend Akismet. It has a default function that discards all the pervasive spam automatically. You can check this Akismet review to get further information.
If you do not want to install any additional plugin, you can also navigate to your Discussion Settings of WordPress admin. Here, you can decide to close the comments on blog posts that are older than a specific number of days. Note that the default number is 30 days. You can reduce it to one week, reducing the spam comments that your site receives.
Tip 3: empty the trash
WordPress has a trash system that is used to store all your deleted items. This means whenever you delete your blog posts, media files, comments, plugins and many other items, they will be sent into your trash folder. This feature prevents you from deleting things in accident.
However, if you remove items regularly or in a massive amount, your trash folder may take up your database greatly. In this case, once you confirm that you no longer need the items that are deleted temporarily, you’d better empty your trash folder all the times.
Tip 4: delete WordPress transients
WordPress transients offer a standardized and simple way for saving cached data in the database in a temporary manner. Generally, the transients are stored in the option table of WordPress database.
To avoid these data that slows down the page loading by adding bloat to your database, you’d better delete all the expired transient records regularly. For this, we highly recommend the Transient Cleaner plugin.
Tip 5: remove unnecessary plugins
If you go through the plugin settings page of your WordPress admin, you may find a list of plugins that are not necessarily useful for your website. For these tools, you’d better disable them, and then delete completely from the Inactive list. This is because every plugin stores some settings and data in your WordPress database, accumulating extra bloat over times on your site.
Besides, some plugins have the settings to remove all the data from your database if they are deleted, but the majority of plugins actually do not have the option. In this case, you’d better make use to the WPDBSpringClean plugin to remove all the tables for your deleted plugins from the WordPress database.
Tip 6: clean wp-commentmeta
This table of wp-commentmeta may increase your database size greatly due to the utilization of Akismet plugin. Therefore, if you are using this security plugin to prevent spam, you’d better run the following SQL queries to reduce the database size.
Note that these two queries need to be processed with the help of WP DB Manager plugin. Besides, as you may change your database name during WordPress installation, you’d better check the table name before running the queries.
Tip 7: use database optimization plugin
In fact, WordPress has a lot of plugins used for the optimization of database, such as WP Optimize and WP DB Manager that can be used to restore, optimize, resize, backup and repair your database. Therefore, if you feel the manual optimization and reduction of WordPress database are time-consuming, you can install one of these two plugins to carry out the work for you.