revert AggregatingMergeTree order by

This commit is contained in:
Francis Cao 2024-08-01 16:40:48 -07:00
parent 57a23bab2d
commit 3207b0ce06

View File

@ -29,7 +29,7 @@ CREATE TABLE umami.website_event
created_at DateTime('UTC'),
job_id Nullable(UUID)
)
engine = MergeTree
ENGINE = MergeTree
PARTITION BY toYYYYMM(created_at)
ORDER BY (toStartOfHour(created_at), website_id, session_id, visit_id, created_at)
PRIMARY KEY (toStartOfHour(created_at), website_id, session_id, visit_id)
@ -50,7 +50,7 @@ CREATE TABLE umami.event_data
created_at DateTime('UTC'),
job_id Nullable(UUID)
)
engine = MergeTree
ENGINE = MergeTree
ORDER BY (website_id, event_id, data_key, created_at)
SETTINGS index_granularity = 8192;
@ -66,7 +66,7 @@ CREATE TABLE umami.session_data
created_at DateTime('UTC'),
job_id Nullable(UUID)
)
engine = MergeTree
ENGINE = MergeTree
ORDER BY (website_id, session_id, data_key, created_at)
SETTINGS index_granularity = 8192;
@ -100,7 +100,14 @@ CREATE TABLE umami.website_event_stats_hourly
)
ENGINE = AggregatingMergeTree
PARTITION BY toYYYYMM(created_at)
ORDER BY (toStartOfDay(created_at), website_id, session_id, visit_id, created_at)
ORDER BY (
website_id,
event_type,
toStartOfHour(created_at),
cityHash64(visit_id),
visit_id
)
SAMPLE BY cityHash64(visit_id);
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly