Skip to content

Instantly share code, notes, and snippets.

Last active February 3, 2020 14:27
What would you like to do?
get the Postal database size for each mail server
SELECT sizes.dbname, orgs.`name` AS org, servers.`name` AS `server`, sizes.size
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 = sizes.fakeid
AND servers.organization_id =
ORDER BY org, `server`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment