-
Notifications
You must be signed in to change notification settings - Fork 21
/
init.sql
38 lines (35 loc) · 1.29 KB
/
init.sql
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
27
28
29
30
31
32
33
34
35
36
37
38
CREATE TABLE IF NOT EXISTS default.graphite_data (
Path String CODEC(ZSTD(3)),
Value Float64 CODEC(Gorilla, LZ4),
Time UInt32 CODEC(DoubleDelta, LZ4),
Date Date CODEC(DoubleDelta, LZ4),
Timestamp UInt32 CODEC(DoubleDelta, LZ4) TTL Date + INTERVAL 1 MONTH
) ENGINE = GraphiteMergeTree('graphite_rollup')
PARTITION BY toYYYYMMDD(Date)
ORDER BY (Path, Time);
CREATE TABLE IF NOT EXISTS default.graphite_reverse (
Path String CODEC(ZSTD(3)),
Value Float64 CODEC(Gorilla, LZ4),
Time UInt32 CODEC(DoubleDelta, LZ4),
Date Date CODEC(DoubleDelta, LZ4),
Timestamp UInt32 CODEC(DoubleDelta, LZ4) TTL Date + INTERVAL 1 MONTH
) ENGINE = GraphiteMergeTree('graphite_rollup')
PARTITION BY toYYYYMMDD(Date)
ORDER BY (Path, Time);
CREATE TABLE IF NOT EXISTS default.graphite_index (
Date Date CODEC(DoubleDelta, LZ4),
Level UInt32,
Path String CODEC(ZSTD(3)),
Version UInt32
) ENGINE = ReplacingMergeTree(Version)
PARTITION BY toYYYYMMDD(Date)
ORDER BY (Level, Path, Date);
CREATE TABLE IF NOT EXISTS default.graphite_tagged (
Date Date CODEC(DoubleDelta, LZ4),
Tag1 String CODEC(ZSTD(3)),
Path String CODEC(ZSTD(3)),
Tags Array(String) CODEC(ZSTD(3)),
Version UInt32 TTL Date + INTERVAL 1 MONTH
) ENGINE = ReplacingMergeTree(Version)
PARTITION BY toYYYYMMDD(Date)
ORDER BY (Tag1, Path, Date);