How To Optimize WordPress Database Size To Improve Performance

By WP Saviour •  Updated: 02/28/21 •  6 min read

There are two vital elements of a typical WordPress set up:

It’s a vital so that you can clear up your WordPress database and cut back its measurement sometimes. Particularly in case you are operating a Woo-Commerce retailer on WordPress, this can be a common stuff try to be doing.

Over time, your WordPress database has amassed many redundant tables, unused information, enormous wp_postmeta and plenty of entries which you’ll be able to take away with out affecting your web site.

It is a must-do course of for each WordPress person to maintain the dimensions of their database at a minimal and hold their WordPress weblog loading rapidly.

This can assist cut back the load in your server and your WordPress efficiency will enhance dramatically.

On this tutorial, I’ll take the instance of WPSaviour’s WordPress database which is 286.Three MB and drastically reduces its measurement. 

You possibly can observe this information step-by-step and carry out these duties on your personal weblog.

Observe: A few of the factors require a bit of technical know-how, and if you end up questioning, be happy to ask within the feedback or skip that step fully. 

Additionally learn: How To Enhance WordPress Efficiency With Superior Database Cleaner Plugin

Tutorial: Methods to Optimize WordPress Database Measurement

Step 1. Take WordPress Database Backup (IMPORTANT)


That is a vital step.

In my case, I’ve used my internet hosting firm’s backup function (WPEngine backup) to take an entire backup of the database and all included recordsdata. In case your internet hosting, affords backup function, then use it earlier than you observe the steps under to optimize WordPress database.

You can even use the WP-DB Supervisor plugin to take a backup of your database file. You’ll find a tutorial over right here. We may also be utilizing WP-DB Supervisor plugin to run just a few SQL queries, empty, and drop database tables (all of which this plugin can do).

Step 2. Disable AND Delete Unused WordPress Plugins


Go by the lively plugin checklist in your WordPress weblog and disable these plugins which you aren’t utilizing anymore. There could be plugins that you simply use on occasion, however I recommend you disable them now and re-install them once they’re wanted once more.

Our objective for as we speak is to utterly optimize the database measurement.

Solely disabling unused plugins is not going to be of a lot assist right here, so be sure to additionally delete these unused plugins.

Talking of helpful plugins:

Step 3. Delete All Spam Feedback, Trash Posts, and Submit Revisions

No matter feedback you could have in your spam and trash folders, delete them.

Equally, delete all posts from the trash folder and delete all submit revisions.


Step 4. Discover and Clear Orphan Tables


Set up the WP Superior database cleaner WordPress plugin & and observe this tutorial.

This plugin will discover orphan and unused tables in your database. Utilizing this plugin will aid you clear all such tables.

It is a fairly vital step and does it solely when you find yourself positive of the desk names which you aren’t utilizing.

If you’re confused, skip this step.

Step 5. Take away Unused Meta Values From Database 

(Warning: Technical data wanted)

That is one thing I do every year and suggests you do it solely in case you are accustomed to phpMyAdmin.

In case you have used phpMyAdmin earlier than, merely observe this straightforward tutorial and do away with all unused meta values out of your database.

This received’t convey down your database measurement considerably, however it is beneficial in case you are extremely decided to wash up your WordPress database.

Step 6. Use MySql Queries To Scale back Database Measurement

One of many tables that are a serious reason for elevated database measurement is “wp_commentmeta” as a result of Akismet plugin.

Earlier than operating the below-mentioned question, my wp_commentmeta measurement was 146 MB.

After optimizing, it diminished to 16.1 MB.

Listed here are two queries which it’s worthwhile to run. Use the WP-DB Supervisor plugin > Run SQL question choice to execute these queries from the WordPress dashboard.

DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
DELETE FROM wp_commentmeta WHERE meta_key LIKE '%akismet%';

Observe: For some WordPress installations, there is a probability your database desk names could be completely different from what’s used within the above code. It may very well be one thing like “wp_commentsmeta”, so don’t overlook to examine your DB desk names and substitute them accordingly.

Listed here are couple extra SQL queries which can be helpful to cut back database measurement:

DELETE FROM wp_postmeta WHERE meta_key = "_edit_lock";
DELETE FROM wp_postmeta WHERE meta_key = "_edit_last";

Step 7. Empty and Drop Unused Database Tables

Once more, this step is for these WordPress customers who’ve a good data of WordPress tables.

Beneath the WP-DB Supervisor plugin, you’ll find an choice to “Empty/Drop Desk” and from there you possibly can see the checklist of all of the tables in your WordPress DB.

Right here you possibly can empty these logs which aren’t helpful and drop these tables which have been created by any plugins that you’re not utilizing anymore.

For instance, I eliminated “wp_roostsettings” which was created by one of many plugins I deleted in Step 2.

Step 8. Optimize Database and Be Amazed

In case you have adopted all the above steps as talked about, it’s now time to optimize your database and see how a lot measurement you could have freed up.

You possibly can optimize your database utilizing the “Optimize” choice of the WP Superior Database cleaner plugin.

As talked about above, my WordPress database measurement was 286 MB earlier than cleansing up, and after all the above-mentioned steps, my database measurement dropped to 96.7 MB.

That’s an enormous discount of 189 MB!

General, in case you have a busy WordPress website, you need to clear your WordPress database as soon as each two months, or at the very least optimize your WordPress database as soon as each two weeks.

Go forward and begin engaged on decreasing your WordPress database measurement and let me understand how a lot house it was earlier than and the way a lot house it’s now.

gp-8301427 as-7639116

WP Saviour

I am a WordPress specialist. My mission is to help you create beautiful websites with ease!