当前位置: 首页 > news >正文

ck随笔

企业微信截图_16950954832640

 1. 分片是逻辑概念, 具体数据都在副本中. (同1分片中的多个副本, 数据完全相同, 以此实现的高可用)

 2. 通过Distributed视图才能实现数据分片.

 3. 一般来说不同的分片数据会落在不同的机器上, 这样才有意义.





创建replace表(相比replacedMergeTree,它支持集群内合并)
create table falcon0328.relationship_agg_result_local on cluster falcon0328
(
        relacode String,
        accountfrom SimpleAggregateFunction(any,String),
        fromtype SimpleAggregateFunction(any,Int32),
        accountto SimpleAggregateFunction(any,String),
        totype SimpleAggregateFunction(any,Int32),
        relatype SimpleAggregateFunction(any,Int32),
    endtime SimpleAggregateFunction(max,Int64),
    `count` SimpleAggregateFunction(sum,Int64)
)
ENGINE = ReplicatedAggregatingMergeTree('/clickhouse/tables/{shard}/relationship_agg_result_local','{replica}')
ORDER BY (accountfrom,fromtype,relacode);

#分布式表
CREATE TABLE falcon0328.relationship_agg_result on cluster falcon0328 AS falcon0328.relationship_agg_result_local ENGINE = Distributed(falcon0328, falcon0328, relationship_agg_result_local, rand());

#创建物化视图
create materialized view if not exists falcon0328.relationship_agg_result_view_local on cluster falcon0328
ENGINE = ReplicatedAggregatingMergeTree('/clickhouse/tables/{shard}/relationship_agg_result_view_local','{replica}') 
ORDER BY (accountto,totype,relatype)
as select relacode,accountfrom,fromtype,accountto,totype,relatype,endtime,`count`
from falcon0328.relationship_agg_result_local;

http://www.rkmt.cn/news/1815.html

相关文章:

  • 终结“网络无助感”:Tenable CEO解析漏洞管理与安全心态
  • 生产搭建Hadoop
  • 生产搭建Rabbitmq
  • macOS Tahoe 26 RC (25A353) Boot ISO 原版可引导镜像下载
  • 企业如何选型低代码平台?4款产品测评
  • torch版本应该跟cuda、cudacnn的版本一致
  • 安装mysql数据库,从下载到配置的详细教程
  • [BJOI2018] 染色 题解
  • 金蝶云星空学习记录1
  • (简记)虚树
  • AI测试平台自动遍历:低代码也能玩转全链路测试
  • Cesium Shader内置变量 czm_*
  • IDA Pro 9.2 发布 - 强大的反汇编程序、反编译器和多功能调试器
  • Java 那些基础又关键的事儿
  • Codeforces Round 1047 (Div. 3)
  • 设计模式-策略
  • 数据库基本查询语句
  • 《Python数据结构与算法分析》代码
  • jmeter测试mysql
  • Docker容器
  • models中integer、char、Boolean、text、datetime字段类型的常用参数设置
  • PVE跨集群迁移虚机
  • 告别资料混乱!PJMan 让项目文件管理,简单到不用找
  • CRMEB标准版PHP订单列表功能解析与实战应用
  • vue3不允许缓存组件keep-alive直接包裹router-view
  • Python中的枚举类
  • Hall 定理相关
  • docker save load 案例
  • 数据结构与算法-25.红黑树
  • Python 虚拟环境使用和打包成exe程序