1

I'm trying to move my website from localhost to a server. the size of DB is too big and from what I saw the cache tables have big size. is there any problem (for my localhost version of site) if I empty all of them? (specially cache_form)

besides that when I was trying to import the DB into server the server reported an error when it was inserting cache_views table; it is very important for me to empty this table to avoid insertion error in the future.

thanks

2
  • I would recommend to either use the drush, or clear the cache from the /admin/config/development/performance page. However if do you some reason you are not able to clear the cache from this place than only you should go for manually clearing the cache tables Oct 20, 2013 at 13:46
  • @AnkitAgrawal clearing the cache from /performance does not empty above mentioned tables. besides that I'm going to clear the cache table because of moving the website
    – M a m a D
    Oct 20, 2013 at 13:49

1 Answer 1

2

As per the drupal community doc for clearing the cache you can manually TRUNCATE the tables (empty, not remove) starting with cache_ and there shouldn't be any problem doing so as on visiting any page the cache is rebuilt.

However I would recommend to either use the drush, or clear the cache from the /admin/config/development/performance page.

If you want to clear the cache from code than you may try the following:

// clear cache
drupal_flush_all_caches();

Also its always safe to keep the Backup of database before making any manual operation on database.

6
  • even though clear cache code didn't clear those tables (it is really surprising!) but from what you and Nigel said, it should be safe. thanks
    – M a m a D
    Oct 20, 2013 at 13:56
  • @Mohammad It may be not emptying the tables as the cache gets rebuilt, so you can manually TRUNCATE the tables (empty, not remove) starting with cache_ and there shouldn't be any problem doing. Oct 20, 2013 at 14:00
  • I did this and successfully imported DB to server, thanks
    – M a m a D
    Oct 20, 2013 at 14:05
  • 1
    That page on DO is not 100% accurate. {cache_form} isn't a true cache table. Totally clearing it may cause problems for any in progress forms.
    – mpdonadio
    Oct 20, 2013 at 16:07
  • @MPD Yeah right, Thanks for mentioning this point :) Oct 20, 2013 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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