Created
September 19, 2016 16:14
-
-
Save joshuabaker/658d5b34d1883d91b1538769af0307d8 to your computer and use it in GitHub Desktop.
MySQL query that returns tables, row counts, and size in megabytes.
This file contains hidden or 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
| select | |
| `table_schema` as `database`, | |
| `table_name` as `table`, | |
| format(`table_rows`, 0) as `rows`, | |
| format(round(((`data_length` + `index_length`) / 1024 / 1024), 2), 2) as `megabytes` | |
| from `information_schema`.`TABLES` | |
| where `table_schema` != 'information_schema' | |
| order by `database`, `data_length` + `index_length` desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment