Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DB cleanup portion of drupal.md #9052

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions source/content/addons/object-cache/howto/drupal.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ contributors: [cityofoaksdesign, carolynshannon, jms-pantheon, whitneymeredith]

</Alert>

```
### 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 `<tablename>` with the name of the cache table, to empty the cache:

```sql
TRUNCATE TABLE `<tablename>`;
```


## Drupal 7

<Alert title="Note" type="info">
Expand Down Expand Up @@ -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.

<Accordion title="Database Cleanup (optional)" id="database-cleanup-d7" icon="lightbulb">

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 `<tablename>` with the name of the cache table, to empty the cache:

```sql
TRUNCATE TABLE `<tablename>`;
```
<Alert title="Note" type="info">

</Accordion>
Review the [Database Cleanup](#database-cleanup) section should be reviewed and implemented accordingly for Drupal 7 sites.

</Alert>

## More Resources
- [Performance Addons](/addons)
Expand Down
Loading