Created
October 29, 2012 17:12
-
-
Save benclark/3974958 to your computer and use it in GitHub Desktop.
SQL snippet for estimating Drupal cache table sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use this query when preparing to move cache tables into memcache bins | |
-- to estimate how big the bins should be (or how many will be necessary). | |
SELECT count(*) tables, | |
concat(round(sum(data_length)/(1024*1024),2),'M') data, | |
concat(round(sum(index_length)/(1024*1024),2),'M') idx, | |
concat(round(sum(data_length+index_length)/(1024*1024),2),'M') total_size | |
FROM information_schema.TABLES | |
WHERE table_schema LIKE '<<DRUPAL DATABASE NAME>>' | |
AND table_name like "cache%" | |
-- Exclude any cache tables you know won't be in memcache: | |
AND table_name NOT IN ('cache_form', 'cache_page'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment