--查询表容量SQL语句
SELECT database, table AS table_name, sum(rows) AS row_num, formatReadableSize(sum(data_uncompressed_bytes)) AS org_size, formatReadableSize(sum(data_compressed_bytes)) AS compress_size, round((sum(data_compressed_bytes) / sum(data_uncompressed_bytes)) * 100, 0) AS compress_ratio FROM system.parts WHERE database='default' GROUP BY table order by sum(rows) desc;
上图个字段含义:
database:数据库名称
table_name:表名称
row_num:数据行数
org_size:表原始尺寸
compress_size:压缩后的尺寸(真实占用磁盘空间大小)
compress_ratio:压缩率