-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathschema.sql
More file actions
26 lines (25 loc) · 705 Bytes
/
schema.sql
File metadata and controls
26 lines (25 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# note: replace {shard} and {replica} and run on each server
DROP TABLE IF EXISTS metrics.samples;
CREATE TABLE IF NOT EXISTS metrics.samples
(
date Date DEFAULT toDate(0),
name String,
tags Array(String),
val Float64,
ts DateTime,
updated DateTime DEFAULT now()
)
ENGINE = ReplicatedGraphiteMergeTree(
'/clickhouse/tables/{shard}/metrics.samples',
'{replica}', date, (name, tags, ts), 8192, 'graphite_rollup'
);
DROP TABLE IF EXISTS metrics.dist;
CREATE TABLE IF NOT EXISTS metrics.dist
(
date Date DEFAULT toDate(0),
name String,
tags Array(String),
val Float64,
ts DateTime,
updated DateTime DEFAULT now()
) ENGINE = Distributed(metrics, metrics, samples, sipHash64(name));