Cleaning your WordPress database is an essential step to optimize your website and improve its loading speed. When you first install WordPress you don't have to worry about the database. The problem comes when you have been with your website for a while and have tried several themes, installed and uninstalled plugins, etc. Tables are created in the database that are later left empty and slow down WordPress.
Most of the major search engines use loading speed as an important factor when it comes to positioning a website in their results pages. As we saw in the last article published on the Core Web Vitals, loading speed (along with user experience) is one of the factors that Google has come to take into account with its new algorithm.
For optimal WordPress performance, you need to have a clean database. Cleaning your WordPress database is part (but not the only part) of the process of optimizing and improving the performance of a website.
Tables in MySQL over time become inefficient as data is added, deleted and moved . Asking MySQL to optimize its tables from time to time will get your website running as fast as possible.
Every time you save a new post or new pages, WordPress creates a revision of that post or page. If you edit a post 6 times, you might have 5 copies of that post as revisions . This quickly adds a lot of seldom used data to your database tables.
You may have thousands of unapproved spam comments in the comments database table. This must also be removed from time to time so as not to spoil the performance of your website.
When you edit a post or page on your website, WordPress automatically saves the new revision to the database. If you edit things multiple times (and especially if the entry is long), your database soon becomes bogged down with old revisions that just sit there, taking up valuable space.
Some plugins let you know exactly which tables in your database are overloaded and wasting space, giving you insight and control to keep your website clean, fast, and efficient.
The plugins shown below allow you to automate database cleanup on a regular basis so you don't have to worry about doing it yourself . You will be able to run an automatic cleaning at a certain time according to your specifications.
If you do not have knowledge of PHP and MySQL, it is preferable that you use one of these 3 plugins for cleaning the database. They are the most recognized and used in the WordPress repository.
This is a very good option if it is the first time you clean your WordPress database since it is 'One Click', that is, you install it, activate it and by clicking on clean database it starts up it alone. It will keep your database clean of old entries, comments, reviews and a lot of other things , although it is not the most advanced.
✅Delete reviews of posts, pages, and/or custom post types
✅Delete posts, pages, and comments in trash (optional)
✅Delete spammed comments (optional)
✅Delete unused tags (optional)
✅Delete “expired or all transients” » (optional)
✅Removes “pingbacks” and “trackbacks” (optional)
✅Clears “OEMBED cache” (optional)
✅Removes “orphaned postmeta elements”
✅Optimizes database tables (optionally, you can exclude certain tables, or even posts / specific pages, from optimization)
✅Create a log of optimizations (optional)
✅Optimization can be scheduled to run automatically once an hour, twice a day, once a day, or once a week at a specific time (optional)
If you choose to analyze the tables, it will try to run an analysis on them, but if you're using a table type that doesn't require this feature, it will tell you. It will not harm your database or any of its data.
you can download it here
It is one of our favorite plugins as it brings together the features of “Optimize Database after Deleting Revisions” and adds other interesting features as well.
WP-Optimize Cache is an all-in-one plugin that caches your WP, cleans the database and compresses the images.
Regarding database cleaning, the main features are:
✅Remove all unnecessary data (e.g. trashed comments/unapproved/spam, stale data) as well as expired pingbacks, trackbacks and transient data options
✅Compact/Defrag MySQL tables with the click of a button Fine-grained
✅control of the optimizations you want to carry performs Performs
✅automatic weekly cleanups (or not)
✅Retains data for a specified number of weeks during cleanups
✅Performs optimizations without the need to run manual queries
✅Allows you to automatically trigger a pre-optimization backup via UpdraftPlus
✅Displays baseline statistics of data and potential savings.
WP-Optimize has a free and paid version . you can download it here
It cleans the database by deleting orphaned elements such as "old revisions", "old drafts", optimizes the database and more... The free version is already quite complete.
✅Delete old post and page revisions Delete old
✅Delete posts from trash
✅comments Delete spam
✅comments Delete comments from trash
✅Delete pingbacks and trackbacks
✅Delete orphaned post metadata
✅Delete orphaned comment meta
✅Delete orphaned user metadata
✅Allows search and filter all items based on their names or values
✅Prevent data from the last few days from being cleaned
✅Allows you to schedule the database cleanup to run automatically
✅Create as many scheduled cleanup tasks as needed and specify which items should be cleaned by the scheduled task
✅Displays information about the database tables, such as the number of rows, the size of the table, and so on.
✅Repair damaged or damaged database tables
✅Schedule database optimization and/or repair to run automatically and specify which tables need to be optimized and/or repaired.
You can view and download it here
Any of these 3 plugins will be super useful when cleaning your WordPress database.