35 lines
1.6 KiB
Plaintext
35 lines
1.6 KiB
Plaintext
DESCRIPTION >
|
|
Generic, org-independent hourly rollup for group-by on ANY low-cardinality event property.
|
|
One row per (dims…, property_key, property_value, hour) — produced by ARRAY JOIN-ing the
|
|
properties JSON in the materialization, so it covers EVERY key with no per-key column and no
|
|
curated list. A new hot key for any org becomes fast from its first event, zero human work.
|
|
|
|
Cardinality safety = an INSERT-TIME value-shape gate in the materialization (see the pipe):
|
|
UUID / long-hex / long-opaque / >64-char VALUES (jobId, requestId, traceId) never produce a
|
|
row, so the tall rollup cannot fan to 1-row-per-event on the explosive keys. Row count tracks
|
|
distinct LOW-CARD values, not event volume. A cron-maintained property_gate (later) is the
|
|
measured backstop for keys that slip the shape heuristic.
|
|
|
|
Sort key leads org_id, env, property_key so `GROUP BY properties.X` scans one contiguous slice;
|
|
customer_id next serves the per-customer hot path. BACKFILL skip: deploy empty + forward trigger
|
|
only; history filled in bounded chunks via events_property_mv_backfill.
|
|
|
|
SCHEMA >
|
|
`org_id` String,
|
|
`env` String,
|
|
`customer_id` String,
|
|
`entity_id` String DEFAULT '',
|
|
`event_name` String,
|
|
`internal_product_id` String DEFAULT '',
|
|
`property_key` String,
|
|
`property_value` String,
|
|
`hour` DateTime,
|
|
`total_value` Float64,
|
|
`event_count` UInt64
|
|
|
|
ENGINE "MergeTree"
|
|
ENGINE_PARTITION_KEY "toYYYYMM(hour)"
|
|
ENGINE_SORTING_KEY "org_id, env, property_key, customer_id, event_name, hour, property_value"
|
|
|
|
BACKFILL skip
|