How to Optimize a WordPress Database

As you already know, the site on WordPress saves all pages, records, menus and other settings in the database. The exception is only the multimedia files uploaded to the posts or pages that are stored in upload folder.

The more garbage data in the database, the more it slows down the site and increases the load on the server.

What is “garbage data” and where do they come from?
Garbage data is unnecessary information stored in the database. Spam comments are the leading reason for such garbage data. Not approved comments, deleted comments, and revision of posts also form garbage data.

How to optimize MySQL database in WordPress
To clean the database of garbage, we will use the WP-Optimize plugin. And so, let’s get started!

Important! Before starting optimization, make sure you back up the site database.

1. Install and activate the plug-in WP-Optimize.

2. After activating the plug-in, we move from the administrative panel to the WP-Optimize section.





3. On the opened page, check the cleaning procedures and press the “PROCESS” button.

Scanning performed by the plugin showed that there are more than 1017 unnecessary revisions in the database and 89 spam comments.

After optimizing the database, the plugin will report on the work done:






The result of cleaning and optimizing the MySQL database is:



Thus, after cleaning the database with the WP-Optimize plug-in, we reduced its size by more than 60% !!!

Once I had a case when after cleaning the database of garbage its size decreased more than 4 times. But before such “records” I do not recommend you to bring the database of the site. Carry out such cleaning at least once a month, and you should not have problems with the database.

The next lesson I want to devote to a fairly interesting and relevant topic – speeding up the site load. Stay in touch, it will be interesting!

Authored By Imran Yousaf

I am Imran Yousaf, a computer geek, founder of the site I am a die hard fond of open-source software and Linux operating system. In addition to Linux, I am interested in everything related to information technology and modern science.