• 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;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    查询语句设置
    -- 设置 查询时最大执行时间(单位: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;
    
    • 1
    • 2
    • 3
    • 4
    表相关设置
    -- 调整表为不使用缓存 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;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    删除数据
    -- 删除分区数据  
    ALTER TABLE log.ck_logs_box_10 DROP PARTITION '20230706'
    
    • 1
    • 2
    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 ;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    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;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
  • 相关阅读:
    远程桌面连接时license错误解决方法
    [附源码]计算机毕业设计JAVAjava航班资源车管理系统
    《痞子衡嵌入式半月刊》 第 62 期
    24.在springboot中使用thymeleaf的属性
    如何避免阿里云对象储存OSS被盗刷
    Kmeans算法实现目标客户聚类分析
    sql 判断教师是否拥有邮箱
    常用web服务器性能相关概念
    C语言程序设计核心详解 第四章&&第五章 选择结构程序设计&&循环结构程序设计
    【pandas小技巧】--花哨的DataFrame
  • 原文地址:https://blog.csdn.net/cheng1483/article/details/132458760