ByConity常用SQL语句
Merger任务
SELECT * FROM system.manipulations;
alter table log.ck_logs_box_10 modify setting cnch_merge_pick_worker_algo='RoundRobin';
SELECT * FROM system.bg_threads
WHERE database = 'log' AND table = 'web_tools';
select * from system.manipulations;
SELECT type, database,table, related_node, count(1)
FROM system.manipulations
group by type, database,table,related_node;
查询语句设置
select ck_date, kind, count()
from log.ck_logs_box_10 group by ck_date, kind
settings max_execution_time = 300;
表相关设置
alter table log.ck_logs_box_10 modify setting enable_local_disk_cache = 0;
alter table log.ck_logs_box_10 modify setting enable_preload_parts = 0;
删除数据
ALTER TABLE log.ck_logs_box_10 DROP PARTITION '20230706'
Parts 相关
select partition_id, part_type, count(), formatReadableSize(sum(bytes_on_disk))
FROM system.cnch_parts
where database='log' and table='ck_logs_box_10' and part_type='VisiblePart'
group by partition_id, part_type order by partition_id;
select name, rows_count, marks_count, formatReadableSize(bytes_on_disk)
FROM system.cnch_parts
where database='log' and table='ck_logs_box_10' and part_type='VisiblePart' and partition_id = '20230719'
order by bytes_on_disk desc ;
Kafka 引擎配置使用
SELECT event_type, event_time, consumer, formatReadableSize(bytes), has_error, exception
FROM cnch_system.cnch_kafka_log
WHERE event_date = today()
AND cnch_database = 'kafka_consume'
AND cnch_table = 'ck_logs_box_10'
AND event_time > now() - 600
ORDER BY event_time desc;
SELECT * FROM system.cnch_kafka_tables
WHERE database = 'kafka_consume'
limit 10;
SYSTEM STOP CONSUME kafka_consume.ck_logs_box_10;
SYSTEM START CONSUME kafka_consume.ck_logs_box_10;
SYSTEM RESTART CONSUME kafka_consume.ck_logs_box_10;