Skip to content

Instantly share code, notes, and snippets.

@vinaysyadav
Created June 14, 2021 12:03
Show Gist options
  • Save vinaysyadav/38d0e7b805452a18d9854cfd6c833828 to your computer and use it in GitHub Desktop.
Save vinaysyadav/38d0e7b805452a18d9854cfd6c833828 to your computer and use it in GitHub Desktop.
// Get sizes of all databases on the server.
SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "database size in MB", sum( data_free )/ 1024 / 1024 "free space in MB" FROM information_schema.TABLES GROUP BY table_schema order by "database size in MB" DESC limit 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment