How do I reduce the size of my WordPress Database
BLOG

How do I reduce the size of my WordPress Database

Table of Contents

As a WordPress site grows, the WordPress database gets bigger.

A big database can create problems. For example, an overpopulated WordPress database can slow page speed, prevent a seamless experience, and cause random errors.

Let’s learn how to reduce the size of a WordPress database from this resource.

How do I reduce the size of my WordPress Database?

Note: Before you proceed, taking site backups helps restore your site if unusual events occur. Once you’ve taken site backups, you can proceed.

Note 2: From now on, the term “database optimization” means “managing database” in a way that helps admins reduce size. In return, seamless page speed performance is achieved.

Let’s dive deep into the subject.

There are three ways to optimize a WordPress database.

WordPress Database optimization via Plugins

Overview

Plugins help admins optimize WordPress databases with point-and-click options.

Once you’ve installed a plugin – configure the scan, select options, and proceed further.

An example of plugins used for database optimization is WP Optimize.

Process

Let’s describe how WP Optimize helps users optimize a WordPress database.

Step 1: Install the WP-Optimize plugin

Go to the Add New Plugin page in the WordPress dashboard and install the plugin. Once the installation process has been finished, activate it.

WP Optimize plugin

WP Optimize plugin

Step 2: Configure the scan options

Once the plugin is installed, users can choose from a list of available checks, as shown in the screenshot below.

WP Optimize scan options

Step 3: Initiate the optimization process

Once selected, clicking the “run all selected optimizations” button initiates the process.

phpMyAdmin for WordPress Database optimization

Overview

phpMyAdmin is an open-source package. It helps users manage MySQL databases over the web.

As compared to plugins, using phpMyAdmin for database optimization is technical. The process requires manual expertise in SQL queries – the statements used to manage MySQL databases.

Alternatively, phpMyAdmin also provides a point-and-click procedure to clean the WordPress database.

Once logged into phpMyAdmin, select a database, select tables you’d like to optimize, and proceed by clicking Optimize Table from the short menu.

So, proceed further and load phpMyAdmin from the site’s cPanel area.

Process

In this case, once the phpMyAdmin loads, you can choose a database and proceed.

Step 1: Load phpMyAdmin from the site’s cPanel

Log into the Hosting cPanel area to locate the phpMyAdmin. If you manage multiple websites, load phpMyAdmin for the specific website you want to optimize.

phpMyAdmin in Hostinger

phpMyAdmin in Hostinger

Note: Depending on the hosting environment, the interface shown in the screenshot above may differ.

Step 2: Choose the Database

Once the phpMyAdmin has finished loading, users can choose a database from the list, which is available on the left panel.

Database list in phpMyAdmin

Database list in phpMyAdmin

Step 3: Select Tables

Next, select the Tables you’d like to clean and optimize. You can choose all tables or proceed with selecting a few.

Tables list in phpMyAdmin

Tables list in phpMyAdmin

Step 4: Initiate the Optimization process

Below, select “Optimize Table” from the short menu. The selection will initiate the process and show a success message on the next screen, as shown in the following screenshot.

reduce WordPress database size

Optimize Table option in phpMyAdmin

Manual Optimization of a WordPress Database

Overview

If you lack expertise or don’t like phpMyAdmin or plugins, you can opt-in for manual procedures to clean the WordPress database.

In this case, the WordPress dashboard provides built-in options to proceed.

Note: We’ve figured out that database optimization is achievable in three ways. Using a plugin to reduce database sites is point-and-click. On the other hand, phpMyAdmin helps you run manual SQL statements and use its point-and-click options for database optimization. Manual procedures help to use the WordPress dashboard’s options for database cleanup.

Let’s proceed further and describe the mentioned procedures in more detail.

Process

Manual routines require expertise.

Let’s proceed.

Delete Plugins

Fewer plugins = fewer entries in the WordPress database

If you’ve useless/unused plugins in WordPress, delete them immediately.

Also, once you’ve installed WordPress, don’t forget to remove the default plugins.

If you can skip a specific plugin while keeping the performance, skip and remove it. For example, don’t install the Classic Editor if you can learn how to use the latest Gutenberg Editor.

Related Reading: Fix the WordPress Update Required Database Error

Delete Spam Comments

Leave genuine comments only. Spam comments in the database mean an over-populated table holding unmeaningful discussion threads, entries, and links.

People leave comments on WordPress posts.

Especially for more significant sites with high traffic spikes – spam comments are common.

The users, random people, or automated tools – leaving comments for building backlinks, fall under spammers. Such comments are spam comments.

On the Comments page in the dashboard, make sure to remove spam comments – regularly.

Remove Trash Pages and Posts

Empty Trash = clean database

Deleting posts or pages doesn’t remove them permanently.

In the WordPress dashboard, the Trash folder holds the deleted entries.

To proceed further, removing deleted items helps users clean up the WordPress database.

Unused Themes

More Themes = more scripts to run in WordPress (Default and demo content also populate WordPress database)

Keeping a second theme is typical for WordPress users; however, deleting unused themes helps admins optimize the WordPress database.

Head over to Appearance -> Themes page in the dashboard, and remove any unused themes.

Remove Post Revisions

Few posts’ revisions = clean database

Post revisions help authors keep a post’s older versions.

For example, updating a post creates a revision in the WordPress database. The entry shows “editing history” and allows users to restore a post’s previous version.

Users can limit post revisions in the database.

If not appropriately configured, the WordPress database populates specific table(s) with revisions as posts are updated.

Deleting post revisions helps you clean up the WordPress database. To proceed, install the Better Delete Revisions plugin.

Users can also limit post revisions in WordPress. To proceed, place the following code snippet in the wp-config.php file.

define( ‘WP_POST_REVISIONS’, 2 );

Note: The above code snippet shows post revisions are limited to 2.

Categories, Tags, and Shortcodes

No Categories/Tags = No possibility of duplicate content, clean database

Unused categories, tags, and shortcodes cause database population.

To see if your site has unused categories and tags, click on the Posts sub-menu in the WordPress dashboard.

If you don’t see a post count indication under a category or tag, remove it.

Similarly, removing unused shortcodes also helps you clean the WordPress database.

Orphan Data

Deleted orphan entries = clean Database

Orphan data refers to unused, unlinked, and random data in a WordPress database.

For example, if a user has created an entry – the entry/data is referred to as an orphan, if:

  1. The specific user who created the entry has been removed.
  2. The data is no longer valuable, used, or linked in WordPress.

So, plugins like WP-Optimize help remove orphan data from the WordPress database. Proceed accordingly.

Remove Backup packages

No backup packages = improved page speed, no entries in the WordPress database

In WordPress, automated backups make life easier; however, if the plans occupy server space, it can cause a “database population”.

Alternatively, it would be good if you configure a remote backup system on Google Drive or Dropbox.

Locate random folders under the server’s root directory, specifically labeled as “Backups”. Once you’ve located data directories, you can remove the folders used for old backup plans.

You can also consult the hosting support channel for assistance.

Similarly, if a plugin for backups is installed – locate and remove backup packages in the WordPress dashboard.

Keeping site backups locally helps admins keep the WordPress database clean, error-free, and speedy.

Summing up

How to reduce WordPress database size?

In this resource, we learned:

  1. How to clean a WordPress database (Basic Procedures)
  2. Overview of the processes (Plugin, phpMyAdmin, and Manual routines)

Here is what we’d like to clarify.

  1. Database optimization requires expertise in WordPress. Don’t make changes if you don’t know how to proceed.
  2. In most cases, cleaning a WordPress database requires the assistance of developers, so it would be a good idea to hire one.
  3. Of course, you should take site backups once you decide to proceed. In this case, it would be good to store backup packages locally.
  4. If possible, perform database cleanup on a staging site first. This will help you avoid problems on the live website.

Let us know your thoughts for more information on WordPress optimization, maintenance, and speed.

Leave a Reply

Comment policy: We value comments and the time that visitors to our blog spend to give feedback. Please note that all comments are manually moderated and any deemed to be spam or promotional will be deleted.