Created
March 9, 2017 11:31
-
-
Save runningnet/5510cba1d1646b15c3c1a0db442e1b18 to your computer and use it in GitHub Desktop.
Datenbank und Tabellen Größen in SQL anzeigen
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
SELECT | |
table_schema AS 'Datenbankname', | |
Round( SUM( data_length ) / 1024 / 1024, 3 ) AS 'Daten (MB)', | |
Round( SUM( index_length ) / 1024 / 1024, 3 ) AS 'Index (MB)', | |
Round( Sum( data_length + index_length ) / 1024 / 1024, 3 ) AS 'Gesamt (MB)', | |
Round( Sum( data_free ) / 1024 / 1024, 3 ) AS 'Freier Speicher (MB)' | |
FROM information_schema.tables | |
GROUP BY table_schema ; | |
SELECT | |
TABLE_NAME AS `Table`, | |
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` | |
FROM | |
information_schema.TABLES | |
WHERE | |
TABLE_SCHEMA = "TABELENNAMMENEINTRAGEN" | |
ORDER BY | |
(DATA_LENGTH + INDEX_LENGTH) | |
DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment