Last active
January 31, 2019 19:18
-
-
Save clebersonfalk/e5c4527bbb6393bc5c6202a9fa6d06d0 to your computer and use it in GitHub Desktop.
Mysql - Get Database sum of data and indexes sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Database size of data + indexes | |
SELECT | |
SUM((DATA_LENGTH + INDEX_LENGTH)) db_bytes, | |
ROUND(SUM((((DATA_LENGTH + INDEX_LENGTH) / 1024) / 1024)), 2) AS db_mb, | |
ROUND(SUM((((DATA_LENGTH + INDEX_LENGTH) / 1024) / 1024) / 1024), 2) AS db_gb | |
ROUND(SUM((DATA_LENGTH + INDEX_LENGTH) / 1073741824), 2) AS db_gb2 | |
FROM | |
INFORMATION_SCHEMA.PARTITIONS | |
WHERE | |
TABLE_SCHEMA = 'db_store_122'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment