Clean up WordPress tables
Using the pro version of the Advanced Database Cleaner, you can identify WordPress orphaned tables so you can proceed with the cleanup. You can also use the free version to perform the cleanup, but with some limitations.
All information on this page concern the "Tables" tab of the plugin, make sure to select it first.
First, don’t forget to make a backup of your database before starting any cleanup. This is very important! In case something went wrong, you can restore it.
In this article
Overview of the "Tables" tab
Click on the "Tables" tab of the plugin:
You will get the list of your WordPress tables as in the following screenshot:
In this box, you can view the scheduled optimization/repair tasks you have created. You can also add a new scheduled task to automatically optimize/repair the specified tables. More details can be found below.
Search and filter tables
If you need to search for specific tables based on their names (or part of their names), their status (to be optimized / to be repaired), or based on their creator (belongs to), you can do it via the filter box:
Here are some examples to use this filter:
- To search for tables containing the word "seo", just write the word "seo" in the "Search for" input text and click the "Filter" button.
- To display tables that should be optimized/repaired, select "To optimize" / "To repair" respectively under the "All tables" drop-down menu, then click "Filter".
- To display tables belonging to the "Jetpack" plugin, select "jetpack" under "All belongs to" drop-down menu and click "Filter button". You can specify a theme as well if needed. This dropdown menu contains the list of your plugins/themes with the number of tables created by each one. (If this drop-down menu is empty, make sure to click on the "Scan tables" button to populate it)
You can as well mix these fields to display specific tables based on your needs. For example, to show all tables containing the word "seo" and belonging to the "Jetpack" plugin that need to be optimized, you should write the word "seo" in the first input text, then select "To optimize", then select "jetpack" under "All belongs to", and click "Filter" button. You can customize this filter box according to your needs.
Action under "Bulk Actions"
You have different actions you can choose from under the "Bulk Actions" drop-down menu of the "Tables" tab:
Action 1: Scan selected tables
This action allows scanning the selected tables. To do this, select a table (or several tables) then select the action "Scan selected tables" and click "Apply", the plugin will then try to identify to which plugins/themes the selected tables belong.
This is useful in some cases when you have already scanned all tables via the "Scan tables" button, and you have noticed that new tables have been created but not categorized yet. To save time, you can select only the "Uncategorized" tables and scan them separately.
Otherwise, you can click on the "Scan tables" button and all your tables will be scanned to identify to which plugins/themes they belong. This will take some time based on the number of tables you have as well as the number of plugins/themes you have installed.
Action 2: Edit categorization
This action allows correcting the automatic categorization performed by the plugin. After scanning all tables (or selected tables), the plugin may assign a table to the wrong plugin/theme. If you recognize that a table belongs to another plugin/theme, select that table (or several tables), then click on the "Edit categorization" action and click "Apply". A new page will appear in which you can select the correct plugin/theme:
In the drop-down menu, select the correct plugin/theme then click the "Save" button. Your correction will then override the plugin results.
Action 3: Optimize
This action allows optimizing the selected tables. The optimization is needed to be performed from time to time after performing many changes to the database content. It will recover any lost space. If there are any tables that should be optimized, the plugin will notify you on the right box:
To show the tables that need to be optimized, click on the number in bold in the right box. You can also use the Filter box at the top of the page and select "To optimize" under the "All tables" dropdown menu, then click on the "Filter" button.
To optimize tables, select the tables that should be optimized, then select the "Optimize" action under "Bulk Actions" and click on the "Apply" button.
Action 4: Repair
This action allows repairing damaged/corrupted tables. Normally, you will not need to perform this action. However, some tables may become corrupted over time. This means that the data inside that table becomes unreadable and, therefore, any attempt to read from a corrupted table will usually cause a server crash. In such a case, you need to repair it.
Make a backup of a table before performing a table repair operation; under certain circumstances, the operation might cause data loss.
If there are any tables that should be repaired, the will plugin will notify you on the right box the same way as the "optimization" action above.
To repair a table, select the table that should be repaired, then select the "Repair" action under "Bulk Actions" and click on the "Apply" button.
Action 5: Empty rows
This action allows emptying a table by deleting all its content (rows). The table itself and its structure will NOT be deleted or changed in any way, only the content is deleted.
To empty a table (or several tables), select the concerned table, then select the "Empty rows" action under "Bulk Actions" and click on the "Apply" button.
Action 6: Delete
This action allows deleting a table with all its content and structure. The table will not be available anymore and will not be displayed since it will be deleted.
If you have identified some orphaned tables and want to delete them, select the concerned tables, then select "Delete" action under "Bulk Actions" and click on the "Apply"
Schedule tables optimization and repair
To schedule an automatic optimization/repair of tables that runs at regular intervals, click on the "Tables" tab of the plugin, then click on "Add new schedule":
You will get the following page on which you can specify your schedule parameters:
By default, all your database tables will be optimized and/or repaired (if needed) according to your schedule settings:
Enter a name of your choice for your scheduled task. The name may contain only: letters, numbers, and underscores.
Set the frequency of your scheduled task, it can be either: Once, Hourly, Twice a day, Daily, Weekly, or Monthly. For the optimization, we recommend setting it to "Weekly" or "Monthly".
Enter a start date for your task from which the optimization/repair will start.
Enter a start time for your task from which the optimization/repair will start.
- You can choose to include one or two operations in your scheduled task: Optimization and/or repair. In general, you should select only the "optimize" operation, unless you really know that you need to add "repair" as well.
Set the schedule to either "Active" to enable it, or "Inactive" if you want to save it but not run it.
Once you have entered all values, click on "Save the schedule" to save your task. Your optimization/repair scheduled task is now saved and will run based on your parameters. You can add as many scheduled tasks as you need. You will notice a new box on the "Tables" tab with information about all your scheduled tasks: