On Drupal 8 sites running versions prior to 8.4.0 the
cache_render table and overall database may rapidly increase in size, filling your disk.
Drupal 8 introduced a robust and thorough caching API. Render caching is enabled by default for many elements such as pages, entities, blocks, and views. Items in this cache do not currently expire. Prior to 8.4.0, a core bug (https://www.drupal.org/node/2526150) may have caused the cache_render table to rapidly increase in size.
Upgrade to the latest version of Drupal core. If this is not possible, follow one of the other mitigation options below.
Other Mitigation options
If you cannot upgrade to the latest version of Drupal core you may have to manage the
cache_render table size manually. This may also be the case if you installed Drupal prior to 8.4 and still have a large
- Occasionally truncate the
- Selectively delete items from the cache_render table based on created date
Truncate the cache_render table
From a MySQL prompt, type:
truncate table cache_render;
Selectively delete items from the cache_render table based on created date
From a MySQL prompt, type
SELECT COUNT(expire) as 'EXPIRE' from cache_render WHERE created < 'TIMESTAMP'; where timestamp is the date in Unix Epoch time. Here are two options for getting "yesterday" in Epoch time (choose one):
date -v -1d +'%s' expr `date +'%s'` - 86400
It's always good to get an idea of the rows involved:
SELECT COUNT(expire) as 'EXPIRE' FROM cache_render WHERE created < '1491593775'; +---------------+ | count(expire) | +---------------+ | 27022 | +---------------+
From there, you can modify the timestamp or delete the rows. Here's the command to delete all rows from
cache_render earlier than a specific date:
DELETE FROM cache_render WHERE created < 'TIMESTAMP';