Clickhouse 创建分布式表
分布表包括逻辑表和物理表,,逻辑表就是表机构用于查询,物理表是实际存储数据的
drop table if exists o_vehicle_data_pre_charging_u_t ON CLUSTER 'ck_uat'; -- auto-generated definition 物理表 create table tdp_main.o_vehicle_data_pre_charging_u_t ON CLUSTER 'ck_uat' ( vin String, tenantId Nullable(String), tboxType Nullable(String), sendType Nullable(String), batteryVoltageData Nullable(String), batteryTempData Nullable(String), collectTime String, receiveTime Nullable(String), chargingStatus Nullable(String), totalCurrent Nullable(String), batterySoc Nullable(String), maxTemp Nullable(String), minTemp Nullable(String), totalDistance Nullable(String), maxCellVoltage Nullable(String), minCellVoltage Nullable(String), createTime Nullable(String) ) engine = ReplicatedMergeTree('/clickhouse/tables/o_vehicle_data_pre_charging_u_t/{layer}/{shard}', '{replica}') ORDER BY (vin, collectTime) SETTINGS index_granularity = 8192; drop table if exists o_vehicle_data_pre_charging_u_d_c ON CLUSTER 'ck_uat'; -- auto-generated definition 逻辑表 create table o_vehicle_data_pre_charging_u_d_c ( vin String, tenantId Nullable(String), tboxType Nullable(String), sendType Nullable(String), batteryVoltageData Nullable(String), batteryTempData Nullable(String), collectTime String, receiveTime Nullable(String), chargingStatus Nullable(String), totalCurrent Nullable(String), batterySoc Nullable(String), maxTemp Nullable(String), minTemp Nullable(String), totalDistance Nullable(String), maxCellVoltage Nullable(String), minCellVoltage Nullable(String), createTime Nullable(String) ) engine = Distributed('ck_uat', 'tdp_main', 'o_vehicle_data_pre_charging_u_t', rand());