1

One of the site has fairly large cachetags table at over 418K records. Is there a way to limit the size of this table.

This table is not cleared on cache clear.

Since Drupal 8.4 there has been a way to limit the size of cache tables, as noted in change record. However, these settings do not affect the size of cachetags table. I tried adding the following to the settings.php file, but these don't work.

$settings['database_cache_max_rows']['cachetags'] = 50000;
$settings['database_cache_max_rows']['bins']['cachetags'] = 50000;
  1. Is it safe to limit or purge the cachetags table?
  2. Is there a way to limit the size of cachetags table without resorting to manually truncating the table?
0

So it appears that Drupal core neither limits the size of cachetags table and not it provides a mechanism to limit it via a setting, like it offers for other cache bins.

Cachetags table is not cleared on cache reset, neither via web browser no via drush.

There is another issue noted in Drupal core that cachetags table can grow endlessly as has been the case that I have come across.

So a blunt method or periodically cleaning the cachetags need to be performed. Something like follows with drush or direct sql statement via mysql cli client or php-myadmin.

drush sqlq "TRUNCATE cachetags;" -l <uri> --no-interaction

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.