Sometimes when moving the database it can be too large. Can any of the "cache_" prefixed tables be emptied without causing problems?

  • 2
    I have not encountered any problems so far, by truncating these tables. – GoodSp33d Dec 20 '12 at 9:00

With one exception, yes. That exception is cache_form. That is not actually a cache table but contains temporary $form_state information of forms currently displayed on your site. Clearing that table would invalidate these forms and when a user then tries to submit that form, he will get an error message and has to fill out that form again.

Note that drush sql-dump and Backup and Migrate automatically leave out the content of these and other tables when creating a database dump with these instead of mysqldump or phpmyadmin.

  • drush sql-dump actually includes the 'cache_form' table. – cjoy Feb 6 '12 at 20:43
  • @remote: I didn't mean to imply otherwise (althought I didn't know that it explicitly keeps cache_form). Feel free to edit (or suggest an edit) if you think my answer is misleading. – Berdir Feb 7 '12 at 3:41

There's a "false friend" in that list. cache_form is not a cache table, and emptying it will invalidate all forms active on the site at that moment.

I also don't see a reason why you would use phpmyadmin for this. It is clunky and error prone. "drush cc all" is your friend :)


The purpose of the cache tables is keeping computed values. When a module calls cache_get(), and it gets back an empty value, then it just executes the code to obtain back the cached values.
All the modules I know automatically execute the code to get the value they were expecting in the cache, if the cache is empty; emptying the cache doesn't cause any problem to the modules using it.


I have done it many times and haven't find any problem by doing it.

Important notice - try to clear all cache tables at once. This will prevent Drupal from using invalid cache data.

  • I have very important data in these tables, are you 120% sure? ;) – Mohammad Ali Akbari Dec 20 '12 at 9:05
  • Yes, But for your very important data please take backup first. :) – j2r Dec 20 '12 at 9:19
  • 2
    @MohammadAliAkbari If you have important data then it should really be stored somewhere else as well as the cache tables... – Chapabu Dec 20 '12 at 9:49
  • @j2r, Me too, I have done it several times. No problem. +1 – Sithu Dec 20 '12 at 10:05
  • @Chapabu I mean the site is important, I did not store any important data myself – Mohammad Ali Akbari Dec 20 '12 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.