SELECT * from system.parts where database = 'shard1' and table = 'upsf_ods_upb_tbl_market_activity_log_info_ulsp_replica';
--shard1 shard2 shard3
SELECT default_database from system.clusters where default_database != '' group by default_database;
--10.0.12.14 10.0.12.15
SELECT host_address from system.clusters where default_database = 'shard1' group by host_address;
--1
SELECT shard_num from system.clusters where default_database = 'shard1' and host_address = '10.0.12.14' ;
--10.0.12.14 shard1
--10.0.12.14 shard3
--10.0.12.15 shard1
--10.0.12.15 shard2
--10.0.12.17 shard2
--10.0.12.17 shard3
SELECT host_address,default_database from system.clusters group by host_address,default_database order by host_address,default_database;
select count() as ct
from "_cw_distributed_db"."tbl_market_log_info_all"
where transDt >= '2021-07-03 00:00:00' AND transDt < '2021-07-04 00:00:00';
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
where active
and `partition` = '2021-07-03'
--and database = 'shard1'
--and name = 'eb6499170211ad91f16371e926ad7d44_687_1368_4'
and table = 'tbl_market_log_info_replication';