mirror of
https://github.com/hanzo-ds/sqlparser.git
synced 2026-10-30 20:53:50 +00:00
17 lines
814 B
SQL
17 lines
814 B
SQL
CREATE TABLE IF NOT EXISTS test_local
|
|
(
|
|
`id` UInt64 CODEC(Delta, ZSTD(1)),
|
|
`api_id` UInt64 CODEC(ZSTD(1)),
|
|
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
|
|
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
|
|
`guage` Float64 CODEC(Gorilla, LZ4),
|
|
`value` UInt64 CODEC(T64, LZ4),
|
|
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
|
|
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
|
|
)
|
|
ENGINE = ReplicatedMergeTree('/root/test_local', '{replica}')
|
|
PARTITION BY toStartOfHour(`timestamp`)
|
|
ORDER BY (toUnixTimestamp64Nano(`timestamp`), `api_id`)
|
|
TTL toStartOfHour(`timestamp`) + INTERVAL 7 DAY,toStartOfHour(`timestamp`) + INTERVAL 2 DAY
|
|
SETTINGS execute_merges_on_single_replica_time_threshold=1200, index_granularity=16384, max_bytes_to_merge_at_max_space_in_pool=64424509440, storage_policy='main', ttl_only_drop_parts=1;
|