Skip to content

Commit

Permalink
feat(chstorage.metrics): lighten schema
Browse files Browse the repository at this point in the history
ernado committed Dec 18, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent e6790a5 commit 48c5242
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/chstorage/schema_metrics.go
Original file line number Diff line number Diff line change
@@ -24,17 +24,21 @@ const (
const (
pointsSchema = `CREATE TABLE IF NOT EXISTS %s
(
name LowCardinality(String) CODEC(ZSTD(1)),
name LowCardinality(String),
timestamp DateTime64(9) CODEC(Delta, ZSTD(1)),
mapping Enum8(` + metricMappingDDL + `) CODEC(T64, ZSTD(1)),
value Float64 CODEC(Gorilla, ZSTD(1)),
mapping Enum8(` + metricMappingDDL + `) CODEC(T64),
value Float64 CODEC(Gorilla),
flags UInt8 CODEC(T64, ZSTD(1)),
attributes String CODEC(ZSTD(1)),
resource String CODEC(ZSTD(1))
flags UInt8 CODEC(T64),
attributes String,
resource String,
INDEX idx_ts timestamp TYPE minmax GRANULARITY 8192
)
ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(timestamp)
PRIMARY KEY (name, mapping, cityHash64(resource), cityHash64(attributes))
ORDER BY (name, mapping, cityHash64(resource), cityHash64(attributes), timestamp);`
metricMappingDDL = `
'NO_MAPPING' = 0,

0 comments on commit 48c5242

Please sign in to comment.