Skip to content

Instantly share code, notes, and snippets.

@m4tlch
Created July 3, 2015 09:51
Show Gist options
  • Save m4tlch/aab8d343430bac536967 to your computer and use it in GitHub Desktop.
Save m4tlch/aab8d343430bac536967 to your computer and use it in GitHub Desktop.
Deleted Field Tables keep multiplying
When you delete a field, if there is data in it, Drupal does a bit of a two-step shuffle to avoid locking the tables while it gets rid of them, so it moves them to other tables so it can go through them one at a time when cron runs.
Sometimes this process does not clean itself up. You will notice It by seeing the number of tables in your DB grow and the DB will contain lots of
tables like this
field_deleted_data_103
field_deleted_data_105
field_deleted_data_109
and
field_deleted_revision_103
field_deleted_revision_154
field_deleted_revision_165
If these tables last longer than a day, something is wrong (maybe cron is failing).
There are three things to try (in order)
1) Run Cron manually /admin/config/system/cron
If that doesn't solve the problem, try step 2
2) Go to the /devel/php or the execute php block and run this
<?php
field_purge_batch()
?>
If that doesn't work, try option 3
3) Remove them by hand
In phpMyAdmin run
DELETE FROM `field_config` WHERE `deleted` = 1;
DELETE FROM `field_config_instance` WHERE `deleted` = 1;
Then drop all the tables that look like
field_deleted_data_###
and
field_deleted_revision_###
References:
http://drupalor.com/2012/07/31/remove-field_deleted_data-drupal-database/
http://drupal.org/node/1276610
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment