Scope
- Use cases
- Compute session-level metrics (e.g., pageviews per session).
- Compute daily metrics (e.g., product clicks per day, orders per day).
- Non-use cases
- Joining with slow-changing dimensions (see S004).
- Building SCD entity history (see S001, S008).
Common steps
Build context
- Select input event streams (e.g.,
ProductClicked,OrderCompleted). - Decide on session gap (e.g., 30 minutes) and windowing strategy.
Implementation notes
- Choose appropriate watermarks to balance latency and correctness.
- For daily aggregates, prefer
TUMBLEwithINTERVAL '1' DAYaligned to UTC or business time zone. - For session windows, Flink supports
SESSIONwindows with a defined gap.
RESINK.AI recommendations
Example
Variations
- Daily orders
Troubleshooting
Window results missing late events
Window results missing late events
Adjust watermark delay or switch to updateable aggregates with retractions if late data is significant.
High cardinality groups cause memory pressure
High cardinality groups cause memory pressure
Pre-aggregate upstream or reduce group keys. Consider hourly aggregates then roll-up downstream.

