Skip to content

Instantly share code, notes, and snippets.

@nevadajames
Last active June 5, 2018 07:48
Show Gist options
  • Select an option

  • Save nevadajames/460bc034d4e38042c0dc83a841370468 to your computer and use it in GitHub Desktop.

Select an option

Save nevadajames/460bc034d4e38042c0dc83a841370468 to your computer and use it in GitHub Desktop.
SQL script for getting table size in gigabytes ordered by largest
SELECT table_name,(data_length+index_length)/power(1024,3) tablesize_gb
FROM information_schema.tables
WHERE table_schema='database_name'
ORDER BY (data_length+index_length)/power(1024,3) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment