Why do WP Plugins leave unused tables in the database after uninstall?

Table of Contents

Reviews of the WordPress plugin directory come from users in different shapes and forms. Some of them are really useful, while others are just a short text, which reduces the essence of the plugin. For example, here is a recent review of WP eCommerce from one of the members: “I removed the plugin, and it left behind an unused table that I had to clean manually. Badly written plugin“.

Justin Sainton, one of the founders of WP eCommerce gave him a detailed answer. He confirmed that the user complaint is true, and they are working to better document this aspect.

We made a deliberate decision not to remove the table from the database when people uninstall or deactivate WP eCommerce”, said Sainton.

We pushed that to the experience we have gained over the years with users who have deactivated and removed the plugin. Even though WordPress is clearly signaled by the removal of data, it is very easy to ignore the notice, when you are in my thoughts“.

For these reasons we have decided not to delete any of the data (involuntary removal of the majority of which would have led to huge problems for business) after uninstallation“.

What are these “orphaned” tables in the database?

“Orphaned” tables: These tables are left by the plugin in the database after its uninstallation. These tables often contain data, including forms, records, settings, etc. For example, when I installed GravityForms 2.0 Tavern on the test site, I found that the forms that I created six years ago, still remain in the database. I was not only surprised but grateful GravityForms, they have not removed the data for so many years.

Deactivating the plugin does not delete data

There are obvious differences between deactivating and removing the plugin. The process of deactivating the plugin happens much more often than deletion, which is associated with troubleshooting. Deactivating the plugin should not lead to the removal of information from the database. Think about how awful it would be if after deactivating the plugins they would have to re-configure from scratch.

Deleting data

Deleting data should be explicitly validated by a user action. Plugin developers who want to enable their users to delete data can register hook to uninstall and add Uninstall .php file.

If the plugin cannot write without performing a specific code within itself, in this case, this plugin should create a file in your uninstall.php base folder. This file will call during the removal of a plugin. The plugin uses uninstall.php so we should always check before performing constant WP_UNINSTALL_PLUGIN.

Developers using this method, users must provide a clear window to confirm the action, which would have indicated that the data will delete. A striking example of the plugin which perfectly implements this approach is GravityForms. The process of removing the plugin separated from the deactivation process. From the warning, it is clear that all data will be lost.

G-Forms-Uninstall-Process

The remaining tables in the database usually do not affect the site performance

Some people believe that a large number of these “orphaned” tables can negatively affect site performance. I learned from Sainton whether this is true or not, and he said the following: “Generally speaking, no“.

Of course, there are cases where the number of tables available in your database can potentially affect the performance of some queries. However, these types of requests cannot actually be performed in most contexts – in particular, in those contexts in which WordPress developers would be interested“.

Most regular WordPress users rarely address the issue of tables remaining in the database. Many simply don’t know about these data and tables that occupy space bytes. In most cases, these tables do not affect the performance of the site in any way, so you just do not worry about them.

Purification of the remaining tables

There are a lot of plugins that allows you to optimize and clean up unused tables in the database. Here are just some examples of the plugins:

  • WP-Optimize
  • P3 (Plugin Performance Profiler)
  • WP-DBManager
  • WP Performance Pack

Before using any of the plugins that were previously in the database and then again installed, it is always better to create a full backup of the site.

I already had a negative experience with the plugin for database cleaning, when it needs to get done, remove the superfluous – arbitrary status records by Edit Flow.

Should the uninstall process to be registered in the directory plugins requirements?

Many plugins in the directory do not use and do not register Uninstall.php hook to uninstall. I believe that any plugin that adds its data in a database should provide a simple way to remove them.

Availability of instructions would greatly simplify the lives of many users, allowing them to maintain the clean database.

Question to developers: Do you suggest any ways to remove data that has added to your plugin user database? Please let us know.

Fully Managed WordPress Hosting

Nestify’s AWS powered dedicated CPU servers keep your sites fast, secure, and always up to date.

Want faster WordPress?

WordPress Speed Optimization

Try our AWS powered WordPress hosting for free and see the difference for yourself.

No Credit Card Required.

Whitelabel Web Hosting Portal Demo

Launching WordPress on AWS takes just one minute with Nestify.

Launching WooCommerce on AWS takes just one minute with Nestify.