VERSION 2
NODE aggregate
SQL >

    SELECT
        workspaceId,
        countState() AS verifications,
        toStartOfHour(fromUnixTimestamp64Milli(time)) AS time
    FROM key_verifications__v2
    GROUP BY
        workspaceId,
        time

TYPE materialized
DATASOURCE mv__verifications_per_workspace_per_hour__v1
ENGINE "AggregatingMergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(time)"
ENGINE_SORTING_KEY "workspaceId, time"
