修改 表引擎 和排序键
This commit is contained in:
parent
6603e14434
commit
73becdce74
12
初始化事件表.sql
12
初始化事件表.sql
@ -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)
|
Loading…
Reference in New Issue
Block a user