File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
oximeter/db/schema/replicated Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ CREATE TABLE IF NOT EXISTS oximeter .measurements_cumulativef64_local_new_15 ON CLUSTER oximeter_cluster
2+ (
3+ timeseries_name String,
4+ timeseries_key UInt64,
5+ start_time DateTime64(9 , ' UTC' ),
6+ timestamp DateTime64(9 , ' UTC' ),
7+ datum Nullable(Float64)
8+ )
9+ ENGINE = ReplicatedMergeTree(' /clickhouse/tables/{shard}/measurements_cumulativef64_local' , ' {replica}' )
10+ PARTITION BY (toYYYYMMDD(timestamp ))
11+ ORDER BY (timeseries_name, timeseries_key, start_time, timestamp )
12+ TTL toDateTime(timestamp ) + INTERVAL 30 DAY;
13+
14+ INSERT INTO oximeter .measurements_cumulativef64_local_new_15
15+ SELECT * FROM oximeter .measurements_cumulativef64_local ;
16+
17+ RENAME TABLE
18+ oximeter .measurements_cumulativef64_local_new_15 to oximeter .measurements .cumulativef64_local,
19+ oximeter .measurements_cumulativef64_local to oximeter .measurements .cumulativef64_local_old_15;
20+
21+ -- TODO: Drop the original table in a separate step, after verifying the migration.
22+ -- DROP TABLE oximeter.measurements_cumulativef64_old_15;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_cumulativef64_local ON CLUSTER
4949 datum Nullable(Float64)
5050)
5151ENGINE = ReplicatedMergeTree(' /clickhouse/tables/{shard}/measurements_cumulativef64_local' , ' {replica}' )
52+ PARTITION BY (toYYYYMMDD(timestamp ))
5253ORDER BY (timeseries_name, timeseries_key, start_time, timestamp )
5354TTL toDateTime(timestamp ) + INTERVAL 30 DAY;
5455
You can’t perform that action at this time.
0 commit comments