Skip to content

Instantly share code, notes, and snippets.

@jfriv
Created March 6, 2018 02:58
Show Gist options
  • Select an option

  • Save jfriv/e08a85bcbea82e6dce5caf486ab4569e to your computer and use it in GitHub Desktop.

Select an option

Save jfriv/e08a85bcbea82e6dce5caf486ab4569e to your computer and use it in GitHub Desktop.
MySQL select table data size and index size in GB for a database
SELECT table_schema, table_name, (data_length / 1024 / 1024 / 1024) as data_size_gb, (index_length / 1024 / 1024 / 1024) as index_size_gb
FROM information_schema.TABLES
WHERE table_schema='mydatabase'
GROUP BY table_name
ORDER BY index_length DESC LIMIT 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment