Database optimizations
This article contains information about the optimization features under the Database tab.
Heads up! Backup your database before you run a cleanup!
In most cases, there shouldn't be any problems, but once a database optimization has been performed, there is no way to undo it. You can see how to manually back up your database here.
Basic requirements
In order for these optimizations to work properly, WP-Cron or a server side cron job should be working, as per our article here.
In an additional note, the Optimize Tables feature will not optimize tables if they're using the InnoDB engine.
How it works
WP Rocket will check the database elements that can be optimized, and then will send queries to the database using a set of WordPress functions and MySQL statements as follows:
Post Cleanup
- Revisions: using the wp_delete_post_revision function for posts with their post_type set to
revision
. - Auto Drafts: using the wp_delete_post function for posts with their status set to
auto-draft
. - Trashed Posts: using the wp_delete_post function for posts with their status set to
trash
.
Comments Cleanup
- Spam Comments: comments with the
spam
value in thecomment_approved
column will be removed using the wp_delete_comment function. - Thrashed Comments: comments with the
trash
orpost-trashed
values in thecomment_approved
column will be removed using the wp_delete_comment function.
Transients Cleanup
- All transients: will use the delete_transient() and delete_site_transient() functions.
Database Cleanup
- Optimize Tables: will optimize the tables using the OPTIMIZE TABLE statement.
Automatic Cleanup
- Schedule Automatic Cleanup: will use a cron job to run the selected database optimization options, depending on the specific chosen interval.
The available cleanup frequencies are daily, weekly and monthly.
Troubleshoot
Slow settings page
In order to count and display the number of database elements to optimize, WP Rocket uses a couple of MySQL queries, if the number of database elements is too big or the server can't handle the processing, WP Rocket's settings page can become slower.
Database optimizations are not working
You can find more information about issues and the respective fixes in this article.