修改 表引擎 和排序键

This commit is contained in:
wuaho 2021-09-07 16:30:47 +08:00
parent 6603e14434
commit 73becdce74

View File

@ -1,5 +1,5 @@
drop table if exists xiangsu.event; drop table if exists debug.event;
create table xiangsu.event create table debug.event
( (
`#ip` Nullable(IPv4), `#ip` Nullable(IPv4),
`#country` Nullable(String), `#country` Nullable(String),
@ -44,12 +44,8 @@ create table xiangsu.event
`#account_id` String, `#account_id` String,
`#distinct_id` Nullable(String), `#distinct_id` Nullable(String),
`#event_name` String, `#event_name` String,
`#server_time` DateTime('UTC') default now(), `#server_time` DateTime('UTC') default now()
) ENGINE = ReplacingMergeTree()
`sign` Int8 default 1
) ENGINE = CollapsingMergeTree(sign)
PARTITION BY toYYYYMMDD(`#event_time`) PARTITION BY toYYYYMMDD(`#event_time`)
order by (`#event_name`, `#event_time`, `#account_id`) order by (`#event_name`, `#event_time`, `#account_id`)
-- TTL event_time + toIntervalDay(365) -- TTL event_time + toIntervalDay(365)