Skip to content

Instantly share code, notes, and snippets.

@JonnoN
Last active January 23, 2024 22:22
Show Gist options
  • Save JonnoN/44398384b3a8b4ff5473b336eeb1c0e2 to your computer and use it in GitHub Desktop.
Save JonnoN/44398384b3a8b4ff5473b336eeb1c0e2 to your computer and use it in GitHub Desktop.
mysql information_schema copypasta
use information_schema;
select table_schema, sum(data_length)/1024/1024/1024 as data_gb, sum(index_length)/1024/1024/1024 as index_gb, sum(data_free)/1024/1024/1024 as free_gb from tables group by table_schema;
select table_schema, table_name, data_length/1024/1024/1024 as data_gb, index_length/1024/1024/1024 as index_gb, data_free/1024/1024/1024 as free_gb from tables where table_schema not in ('mysql', 'information_schema', 'performance_schema', 'sys') order by data_gb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment