Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Contemplating on what is the best way to regenerate an orders table from our
raw_eventsMergeTree table.Basically maintain an up-to-date
orderstable that reflect the current state of the order based on incoming change events. Use case is for various analytical queries like "revenue from cancelled orders" etc.Context
raw_eventsMergeTree table that receives order-related eventsorder_created,order_updated,order_fulfilled,order_cancelledorder_created: Most of the properties that we need come from this event, including theorder_dateorder_updated: Can modify any order propertyorder_fulfilled/order_cancelled: Only update specific columns (e.g., status, cancelled_at)What I have tried
I'm considering two approaches:
1. AggregatingMergeTree:
With a materialized view to maintain it:
Querying requires merging the aggregate functions:
2. ReplacingMergeTree:
ORDER BYorder_idevent_timeas versionQuestions
Beta Was this translation helpful? Give feedback.
All reactions