WordPress is a great platform. However, it comes with its disadvantages. It is fast and full of features. Plugins, on the other hand, provides functionality. Over time, it is very common for sites to install plugins over time. Once a plugin is installed, it creates tables in the database automatically. It is also obvious that some plugins are deleted from the database. When plugins are deactivated or uninstalled, the tables are not removed by WordPress. This leads to database cluster and website slowdown.
In this article, we will go through each step on how to cleanup database by removing old plugin tables. But before we get started, let’s understand what happens when a plugin is installed or deleted.
How to cleanup database by removing old plugin tables
When a new plugin is installed, it creates a table in the database. So, what exactly a table does? A table stores data and every time the plugin runs, it stores or fetches information.
Now, let’s try to understand what happens when a plugin is uninstalled. By default, WordPress is configured to only delete the related files from the installation directory. This means that the tables remain untouched and they stay there clogging the whole database. Also, the bigger the database, the longer a simple query takes time to get executed. That’s why it is always better to cleanup database by removing old plugin tables.
To solve this problem, all you need to do is install Plugins Garbage Collector. This plugin is very useful when it comes to removing old plugin tables.
Step 1: Install and activate the plugin.
Step 2: Go to Tools > Click on “Plugins Garbage Collection.”
Step 3: Once done, all you need to do is select “Search non-WP tables” and then click on Scan Database button. The scan will take some time depending on how big your database is.
Step 4: Now you see a list of tables that are not used by WordPress anymore. This means the table are used by plugins when they were activated.
You can simply click on them and then click on “Delete tables.”
Warning: Only remove the tables that you can relate to. For example, you can guess the name of the plugin by table name. However, there are many table names that you might not recognize. To know which plugin it relates to, you just need to Google the table name. Also, do not delete a table if you are not sure. Just let it be there.
What happens when you delete a table of the old plugin?
The tables hold the old settings. If you decide to delete the table, then all the old settings or information will be lost.
If you are not comfortable with a plugin doing the work and you want to do it yourself, you can do it by using PHPadmin. Only use this method if you know what you are doing. Also, always backup your database before starting.
Step 1: Go to your website Cpanel.
Step 2: Click on phpMyAdmin
Step 3: Now select the table that you want to delete.
Step 4: Click on “Operations” as shown in the image below.
Step 5: Click on “Delete the table(DROP)” to delete the table forever.
Step 6: Click on “Confirm”
Cleaning database is important for any website. Always choose to backup your database before making any changes to the database. Also, feel free to comment below and let us know which method you are using!