首页 > 其他分享 >查看ClickHouse中某个表的详情

查看ClickHouse中某个表的详情

时间:2023-02-02 17:24:45浏览次数:47  
标签:min bytes uncompressed date formatReadableSize 详情 某个 data ClickHouse

进入终端:sudo docker exec -it msun-clickhouse clickhouse-client --port 10000 --user 用户--password 密码 -m

select
    database,
    table,
    formatReadableSize(size) as size,
    formatReadableSize(bytes_on_disk) as bytes_on_disk,
    formatReadableSize(data_uncompressed_bytes) as data_uncompressed_bytes,
    formatReadableSize(data_compressed_bytes) as data_compressed_bytes,
    compress_rate,
    rows,
    days,
    formatReadableSize(avgDaySize) as avgDaySize
from (
    select
        database,
        table,
        sum(bytes) as size,
        sum(rows) as rows,
        min(min_date) as min_date,
        max(max_date) as max_date,
        sum(bytes_on_disk) as bytes_on_disk,
        sum(data_uncompressed_bytes) as data_uncompressed_bytes,
        sum(data_compressed_bytes) as data_compressed_bytes,
        (data_compressed_bytes / data_uncompressed_bytes) * 100 as compress_rate,
        max_date - min_date as days,
        size / (max_date - min_date) as avgDaySize
    from system.parts
    where active  and database = '数据库' and table = '数据表'
    group by database, table
);

 

标签:min,bytes,uncompressed,date,formatReadableSize,详情,某个,data,ClickHouse
From: https://www.cnblogs.com/chuijingjing/p/17086712.html

相关文章