From 87166500dfec16946ba1798bf176a16637bcd818 Mon Sep 17 00:00:00 2001 From: codyfishman <89869823+codyfishman@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:00:10 -0500 Subject: [PATCH] Update DB cleanup portion of drupal.md The DB cleanup portion of this doc is recommended and is relevant to both D7 and D9.3+ Redis implementations. --- .../addons/object-cache/howto/drupal.md | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/source/content/addons/object-cache/howto/drupal.md b/source/content/addons/object-cache/howto/drupal.md index d093279bdd..aca84d8e72 100644 --- a/source/content/addons/object-cache/howto/drupal.md +++ b/source/content/addons/object-cache/howto/drupal.md @@ -119,6 +119,26 @@ contributors: [cityofoaksdesign, carolynshannon, jms-pantheon, whitneymeredith] + ``` +### Database Cleanup (Recommended) + +After enabling Redis, there are cache tables in the database that are no longer being used. Even when the Drupal cache is cleared, these tables will not be emptied. For sites that were live for awhile before Redis was enabled, there could be significant amounts of data in these tables. Removing this data could increase the speed of cloning, exporting, and backing up the database. + +1. [Connect directly to MySQL](/guides/mariadb-mysql/mysql-access) and run the command below to view the cache: + + ```sql + SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'cache%' AND table_name != 'cache_form'; + ``` + + This returns a list of all the cache tables in the database. These are safe to empty, but don't remove the tables themselves in case Redis is disabled in the future. + +1. Run the command below on each table, replacing `` with the name of the cache table, to empty the cache: + + ```sql + TRUNCATE TABLE ``; + ``` + + ## Drupal 7 @@ -168,26 +188,11 @@ This configuration uses the `Redis_CacheCompressed` class for better performance 1. Visit `/admin/config/development/performance/redis` and open **Connection Information** to verify the connection. - - -After enabling Redis, there are cache tables in the database that are no longer being used. Even when the Drupal cache is cleared, these tables will not be emptied. For sites that were live for awhile before Redis was enabled, there could be significant amounts of data in these tables. Removing this data could increase the speed of cloning, exporting, and backing up the database. - -1. [Connect directly to MySQL](/guides/mariadb-mysql/mysql-access) and run the command below to view the cache: - - ```sql - SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'cache%' AND table_name != 'cache_form'; - ``` - - This returns a list of all the cache tables in the database. These are safe to empty, but don't remove the tables themselves in case Redis is disabled in the future. - -1. Run the command below on each table, replacing `` with the name of the cache table, to empty the cache: - - ```sql - TRUNCATE TABLE ``; - ``` + - +Review the [Database Cleanup](#database-cleanup) section should be reviewed and implemented accordingly for Drupal 7 sites. + ## More Resources - [Performance Addons](/addons)