Created
February 18, 2021 17:17
-
-
Save masroorhasan/e96896f94427286552de361a9388a259 to your computer and use it in GitHub Desktop.
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 | |
parts.*, | |
columns.compressed_size, | |
columns.uncompressed_size | |
FROM | |
( | |
SELECT | |
table, | |
formatReadableSize(sum(data_uncompressed_bytes)) AS uncompressed_size, | |
formatReadableSize(sum(data_compressed_bytes)) AS compressed_size | |
FROM system.columns | |
WHERE database = currentDatabase() | |
GROUP BY table | |
) AS columns | |
RIGHT JOIN | |
( | |
SELECT | |
table, | |
any(engine) AS engine | |
FROM system.parts | |
WHERE active AND (database = currentDatabase()) | |
GROUP BY | |
database, | |
table | |
) AS parts ON columns.table = parts.table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment