clikchouse如何查看某张表的某个分区的容量、行数和压缩率?

提问者:帅平 问题分类:大数据
clikchouse如何查看某张表的某个分区的容量、行数和压缩率?

 您阅读本篇文章共花了: 

1 个回答
自然萌鹿鹿
自然萌鹿鹿
也是从system.parts表里面查看,示例如下:
SELECT 
    partition AS `分区`,
    sum(rows) AS `总行数`,
    formatReadableSize(sum(data_uncompressed_bytes)) AS `原始大小`,
    formatReadableSize(sum(data_compressed_bytes)) AS `压缩大小`,
    round((sum(data_compressed_bytes) / sum(data_uncompressed_bytes)) * 100, 0) AS `压缩率`
FROM system.parts
WHERE (database IN (${数据库名})) AND (table IN (${表名})) AND (partition LIKE ${分区名})
GROUP BY partition
ORDER BY partition ASC
发布于:2个月前 (02-29) IP属地:未知
我来回答