ClickHouse中各表空间占用统计

  |   0 评论   |   0 浏览
select
   table,
  sum(rows) as row,
  formatReadableSize(sum(bytes_on_disk)) as bytes_on_disk,
  formatReadableSize(sum(data_uncompressed_bytes)) as ysq,
  formatReadableSize(sum(data_compressed_bytes)) as ysh,
  round(sum(data_compressed_bytes) / sum(data_uncompressed_bytes) * 100, 0) ys_rate
from system.parts
group by table
order by sum(data_compressed_bytes) desc;
select
  sum(rows) as row,
  formatReadableSize(sum(bytes_on_disk)) as bytes_on_disk,
  formatReadableSize(sum(data_uncompressed_bytes)) as ysq,
  formatReadableSize(sum(data_compressed_bytes)) as ysh,
  round(sum(data_compressed_bytes) / sum(data_uncompressed_bytes) * 100, 0) ys_rate
from system.parts