Last active
February 3, 2020 14:27
-
-
Save willpower232/a9a9e54fa064f34f558f606106fd99b6 to your computer and use it in GitHub Desktop.
get the Postal database size for each mail server
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
SELECT sizes.dbname, orgs.`name` AS org, servers.`name` AS `server`, sizes.size | |
FROM ( | |
SELECT substring(sizes.table_schema, 15) AS fakeid, sizes.table_schema AS dbname, ROUND(SUM(sizes.data_length + sizes.index_length) / 1024 / 1024, 1) AS size | |
FROM information_schema.`TABLES` AS sizes | |
GROUP BY sizes.table_schema | |
) AS sizes, postal.servers AS servers, postal.organizations AS orgs | |
WHERE servers.id = sizes.fakeid | |
AND servers.organization_id = orgs.id | |
ORDER BY org, `server` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment