A machine-readable guide to this site for AI agents and language models is available at/llms.txt(https://dev.acquia.com/llms.txt on the production site).
Truncating a large database table | Cloud Platform | Acquia Product Documentation
Cloud Platform
Truncating a large database table
Truncating a large database table
Date Published: February 6, 2025
Issue
One or more tables in your database are too large and need to be reduced in size. For information on assessing your disk space usage see Disk Storage.
Resolution
Before attempting to reduce the size of any database, it is important that you make a backup as is best practice. For more information, visit Backing up your Drupal database.
After you have backed up the database, you could use the following command to connect to your database, replacing [site-uri] with the base URL to the website you want to connect to:
drush sqlc --uri=[site_URL]
Important
Make sure to include the URI flag (especially if you have a multisite application) to ensure that you are connecting to the correct database. For example:
drush sqlc --uri=www.acquia.com
Now that you have a backup, are connected to the correct DB and know which table needs to be truncated (table_name), run the following command:
TRUNCATE TABLE table_name;
For example, if the table you needed to truncate was cache_container.idb, you would run this command
TRUNCATE TABLE cache_container;
For more information on truncating a table, please see Managing Large Cache Render tables in Drupal 8, which outlines how to truncate the cache_render table in particular, for Drupal 8.