Created
January 5, 2025 22:56
-
-
Save nicksherron/8b3363a7df9547283d80dbe7adb65683 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 | |
l.* EXCEPT(total_compressed_bytes, data_compressed_bytes), | |
formatReadableSize(total_compressed_bytes) as total_comp | |
FROM ( | |
SELECT | |
name, | |
type, | |
data_compressed_bytes, | |
sum(data_compressed_bytes) OVER (ORDER BY data_compressed_bytes DESC) AS total_compressed_bytes, | |
formatReadableSize(data_compressed_bytes) as comp, | |
formatReadableSize(data_uncompressed_bytes) as uncomp, | |
-- use xxx and xx to show if is_in_partition_key, is_in_sorting_key, is_in_primary_key | |
-- is_in_partition_key, | |
-- is_in_sorting_key, | |
-- is_in_primary_key | |
case when is_in_partition_key and is_in_sorting_key and is_in_primary_key then 'xxx' | |
when is_in_sorting_key and is_in_primary_key then 'xx' | |
when is_in_primary_key then 'x' | |
else '' end as keys | |
FROM system.columns | |
WHERE `table` = 'logs' | |
ORDER BY data_compressed_bytes DESC | |
) l | |
Format PrettyCompactMonoBlock; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment