perf: ️ engine sort by id; pipe prefill ordered

This commit is contained in:
amianthus
2026-03-10 10:58:09 +00:00
parent 3bfa664990
commit 2c69919e3f
2 changed files with 4 additions and 3 deletions

View File

@@ -17,4 +17,4 @@ SCHEMA >
ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(timestamp)"
ENGINE_SORTING_KEY "org_id, env, timestamp, customer_id, event_name"
ENGINE_SORTING_KEY "org_id, env, timestamp, id, customer_id, event_name"

View File

@@ -2,7 +2,7 @@ DESCRIPTION >
Materializes events into events_by_timestamp_mv for fast time-range listing.
Copies all event columns without aggregation - just re-sorted by timestamp.
NODE materialize
NODE transformation_node
SQL >
SELECT
id,
@@ -16,6 +16,7 @@ SQL >
idempotency_key,
entity_id
FROM events
ORDER BY timestamp DESC, id DESC
TYPE materialized
DATASOURCE events_by_timestamp_mv