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

Comments Cleanup

  • Spam Comments: comments with the spam value in the comment_approved column will be removed using the wp_delete_comment function.
  • Thrashed Comments: comments with the trash or post-trashed values in the comment_approved column will be removed using the wp_delete_comment function.

Transients Cleanup

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.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.