The maintenance of your site WordPress is not only limited to updating themes and plugins or creating new content. An equally important, but often overlooked, aspect is the effective database management. In particular, two tables that can become quite voluminous and potentially affect the performance of your site are actionscheduler_actions
e actionscheduler_logs
.
What is Action Scheduler and what tables does it use?
Action Scheduler is a tool that many WordPress plugins, such as WooCommerce, use to manage planned activitiesalso called 'cron jobs'. These tasks are operations that your site performs automatically in the background, e.g. sending notification e-mails, generating reports and so on.
Tables actionscheduler_actions
e actionscheduler_logs
respectively store these planned activities and the logs of their executions. Over time, these tables can accumulate an enormous amount of data, especially if your site performs many planned activities.
Preparation for database cleaning
Before proceeding with the cleaning of these tables, there are some important precautions to consider:
1. Data backup: No matter how sure you are about what you are doing, it is always essential to make a backup of your database before making significant changes. Plugins such as UpdraftPlus o BackupBuddy can help you do this easily and safely.
2. Knowledge of the system: Before you start deleting data from tables, make sure you understand which activities are managed by Action Scheduler on your site. Deleting data on crucial activities may have unintended consequences.
How to Clean Database Tables
There are several methods for cleaning tables actionscheduler_actions
e actionscheduler_logs
. Here are three of the most effective methods:
1. Use of WP-CLI: If you have access to WP-CLI, the WordPress command line interface, you can use the commands provided by Action Scheduler to clean up completed or failed actions. The command to use is wp action-scheduler run --cleanup
.
2. Database cleaning plugins: There are numerous WordPress plugins designed specifically to clean the database. WP-Optimise e Advanced Database Cleaner are among the most popular. These plugins allow you to select and clean up specific database tables.
3. Direct SQL: If you are comfortable with using SQL, you might consider running SQL queries directly on your database to clean up tables. A possible query to delete completed tasks could be DELETE FROM actionscheduler_actions WHERE status='complete';
. Remember, however, that this method should be used with extreme caution.
Conclusion
Database optimisation is an essential component of maintaining a WordPress site. A regular cleaning of the database can release an enormous amount of storage space and improve the performance of your site. Always remember to make a backup of your site and your database before cleaning it up and, if necessary, consult an expert to ensure that the changes do not affect the proper functioning of your site.