init_db.sql 975 B

12345678910111213141516
  1. CREATE TABLE IF NOT EXISTS tsdb_cpp (
  2. metric_name LowCardinality(String) COMMENT 'Metric name',
  3. point_name LowCardinality(String) COMMENT 'Point name',
  4. tags Map(LowCardinality(String), LowCardinality(String)) COMMENT 'Point tags',
  5. value Float64 COMMENT 'Point value' Codec(Gorilla, LZ4),
  6. nanoseconds Int64 COMMENT 'Point time in nanoseconds' Codec(DoubleDelta, LZ4)
  7. ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/tsdb_cpp', '{replica}')
  8. ORDER BY (metric_name, point_name, nanoseconds);
  9. CREATE TABLE IF NOT EXISTS tsdb_cpp_dist (
  10. metric_name LowCardinality(String) COMMENT 'Metric name',
  11. point_name LowCardinality(String) COMMENT 'Point name',
  12. tags Map(LowCardinality(String), LowCardinality(String)) COMMENT 'Point tags',
  13. value Float64 COMMENT 'Point value' Codec(Gorilla, LZ4),
  14. nanoseconds Int64 COMMENT 'Point time in nanoseconds' Codec(DoubleDelta, LZ4)
  15. ) ENGINE = Distributed(main_cluster, default, tsdb_cpp, rand());