TU
и
_date
вам не нуженДОЛЖНО БЫТЬ ТАК AggregatingMergeTree partition by toYYYYMM(
time
) order by (importance
, time
)CREATE MATERIALIZED VIEW foo.events_importance (
`count` AggregateFunction(count),
`time` DateTime('UCT'),
`importance` String,
`_date` Date
) ENGINE = AggregatingMergeTree()
PARTITION BY toDate(time)
ORDER BY (toDate(time), importance)
SETTINGS index_granularity = 8192 AS
SELECT
countState() AS count,
toStartOfMinute(toDateTime(time)) AS time,
importance,
toDate(time) AS _date
FROM foo.events
GROUP BY time, importance