It is impossible to speed up the site without cleaning up the database (DB). We often need to optimize databases of different sizes: from 20 MB to 2 GB.
Of course, cleaning up the database via phpMyAdmin is not an option. Do not forget that you have a WordPress site – everything should be simple and convenient. In fact, there are a number of plugins out there that make it easy to optimize your database. We will tell you about them.
DB optimization points
First, let’s figure out what exactly in the database can be optimized:
- Optimization of tables.
- Cleaning up old and unnecessary data: revisions, spam comments, deleted materials, drafts. It is also possible to delete transactions, but we do not recommend doing this if your site does not have problems with CRON.
- Removing unnecessary tables.
- Clearing unnecessary options.
- Removing unnecessary events in CRON.
Choosing a plugin for cleaning up the database
The database requires an attentive and careful attitude towards itself, so we immediately sweep aside all the little-known plugins and stop at the proven ones. Unfortunately, there are not many free WordPress plugins available for this task.
We remind you that before cleaning the database, it is highly advisable to download your own backup copy.
Advanced Database Cleaner PRO
At the moment, this is the ideal plugin for cleaning up the WP database, but only the paid version should be considered (the functionality of the free one is heavily curtailed).
In addition to standard cleanups and optimizations, Advanced Database Cleaner PRO offers manual cleanup of CRON events, deletion of any database tables and options.
An important feature of this particular plugin is a clear definition and indication of which plugin a particular table or option belongs to. If the plugin cannot confidently determine the affiliation, then it indicates the percentage of probability.
We will consider in detail how to work with the Advanced Database Cleaner PRO plugin.
General clean-up tab
Put a tick in the checkboxes opposite the actions that you want to perform. You can select all at once, but we recommend not clearing Expired transients unnecessarily. It is also worth reviewing pending and spam comments before deleting.
By clicking on the eye icon in the View column, you will see everything that can be cleaned, and you can also delete individual items.
Another useful feature is the exclusion from data cleansing for a certain number of days. Opposite all the cleaning items in the Keep last column there is an Edit button. Click it and enter a number – for how many last days the database cleaning will not affect these items.
Here you will also find the Add new schedule button to schedule automatic database cleanup.
To recognize whether the tables are plugins, click the Scan tables button.
After scanning, the Belongs to column indicates which plugin the table is associated with. If this field contains Orphan, then you can safely (not always) delete the table.
You can sort tables by size or title and view them. We recommend sorting by title and manual browsing. You will probably find several tables with plugin names that you do not know or have deleted a long time ago. They can also be deleted.
Determine the belonging of the options by clicking Scan options.
Here you already need to be careful, because the probability of error is increased. First, select the display of Orphans (number) to the right of the Scan options button. Look carefully at their names and delete unnecessary ones.
If the name of the option does not mean anything to you, do a search on it in Google, it helps in 90% of cases. Sometimes the defining information is in the second column: if you see an ellipsis there, hover over it and read the pop-up text.
After you’ve finished cleaning Orphans, select show all options and set to show all rows on one page, sort by title.
Now look through the Option name and mark unnecessary ones. For example, if you do not already have the WP-Optimize plugin, then the name of the unnecessary options will contain wpo or wp-optimize. If you have removed the Smush plugin, look for smush in the option names.
Cron jobs Tab
As always, click on the blue Scan tasks button and view the results.
Delete only those tasks where you can accurately determine by the name that such a plugin is no longer there.
As a result of the cleaning, your database will significantly decrease, which means that the server response time will decrease, the site loading speed will increase and the PageSpeed indicators will increase.
There is only a paid version: read more.
There is no way without the WP Rocket, because this is the best website speedup plugin.
Database cleanup is located in a separate tab of the WP Rocket dashboard. Here is a standard set: cleaning revisions, comments, transactions, deleted data, tables optimization, cleaning schedule. There is no function to delete tables – do not forget that the plugin is made not only for advanced users. In other words, everything is clear, convenient and carried out in 1 click.
There is a functional free version: link.
An interesting and useful plugin for database and images optimization, minification and caching.
If you are not pretentious about the results, then this plugin is for you. It does job well. But it could be better: there are small flaws in every area of WP-Optimize’s work.
The paid version differs only in support of lazy loading of images, which is implemented through free plugins.
With regard to the database, the plugin offers deleting old and unnecessary data, optimizing tables, as well as deleting some tables for which WP-Optimize has exact data that the plugin that created them has already been deleted (it often makes mistakes).
Few other plugins for DB cleaning see here.