zoukankan      html  css  js  c++  java
  • 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());
    

      

  • 相关阅读:
    POJ 1659 Frogs' Neighborhood (贪心)
    HDU 2544 最短路 (Floyd)
    CodeForces 632C Grandma Laura and Apples (模拟)
    CodeForces 731F Video Cards (数论+暴力)
    CodeForces 731C Socks (DFS或并查集)
    CodeForces 731B Coupons and Discounts (水题模拟)
    CodeForces 731A Night at the Museum (水题)
    UVaLive 6834 Shopping (贪心)
    zzuli 1484 继续双线
    zzuli 1875多线DP
  • 原文地址:https://www.cnblogs.com/irobotzz/p/15268972.html
Copyright © 2011-2022 走看看