技术文章
ByConity常用SQL语句
ByConity常用SQL语句
Merger任务
-- 查询merger任务状态
SELECT * FROM system.manipulations;
-- 调整表 Merger 任务
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';
-- 查看当前 Merger 情况
select * from system.manipulations;
-- 查看当前 Merge 并发任务量
SELECT type, database,table, related_node, count(1)
FROM system.manipulations
group by type, database,table,related_node;
查询语句设置
-- 设置 查询时最大执行时间(单位:s): settings max_execution_time = 300;
select ck_date, kind, count()
from log.ck_logs_box_10 group by ck_date, kind
settings max_execution_time = 300;
表相关设置
-- 调整表为不使用缓存 enable_local_disk_cache = 0, 用缓存的话 设置为 1
alter table log.ck_logs_box_10 modify setting enable_local_disk_cache = 0;
-- 配置为 reard 端主动读取数据 enable_preload_parts = 1,不使用设置为 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 相关
-- 查看 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;
-- 查看 指定日期的 parts
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 引擎配置使用
-- 查看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;
-- 将kafka 引擎停止
SYSTEM STOP CONSUME kafka_consume.ck_logs_box_10;
-- 将kafka 引擎开始
SYSTEM START CONSUME kafka_consume.ck_logs_box_10;
-- 将kafka 引擎重启
SYSTEM RESTART CONSUME kafka_consume.ck_logs_box_10;
版权声明:
本文为[cheng1483]所创,转载请带上原文链接,感谢
https://blog.csdn.net/cheng1483/article/details/132458760