Skip to content

Instantly share code, notes, and snippets.

@andreyuhai
Created June 23, 2020 21:17
Show Gist options
  • Save andreyuhai/0dbeb108a8e58f7b16dd8b83e7073914 to your computer and use it in GitHub Desktop.
Save andreyuhai/0dbeb108a8e58f7b16dd8b83e7073914 to your computer and use it in GitHub Desktop.
Get the size of a database
SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema; 

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment