CREATE TABLE IF NOT EXISTS tsdb_cpp ( metric_name LowCardinality(String) COMMENT 'Metric name', point_name LowCardinality(String) COMMENT 'Point name', tags Map(LowCardinality(String), LowCardinality(String)) COMMENT 'Point tags', value Float64 COMMENT 'Point value' Codec(Gorilla, LZ4), nanoseconds Int64 COMMENT 'Point time in nanoseconds' Codec(DoubleDelta, LZ4) ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/tsdb_cpp', '{replica}') ORDER BY (metric_name, point_name, nanoseconds); CREATE TABLE IF NOT EXISTS tsdb_cpp_dist ( metric_name LowCardinality(String) COMMENT 'Metric name', point_name LowCardinality(String) COMMENT 'Point name', tags Map(LowCardinality(String), LowCardinality(String)) COMMENT 'Point tags', value Float64 COMMENT 'Point value' Codec(Gorilla, LZ4), nanoseconds Int64 COMMENT 'Point time in nanoseconds' Codec(DoubleDelta, LZ4) ) ENGINE = Distributed(main_cluster, default, tsdb_cpp, rand());