Skip to content

Commit 60b987a

Browse files
authored
Update 5minutely_aggregation.sql
1 parent 5fa8970 commit 60b987a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

5minutely_aggregation.sql

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ BEGIN
2525
GROUP BY customer_id,event_type,country,browser,minute
2626
ON CONFLICT (customer_id,event_type,country,browser,minute)
2727
DO UPDATE
28-
SET event_count=excluded.event_count,
29-
device_distinct_count = excluded.device_distinct_count,
30-
session_distinct_count= excluded.session_distinct_count;
28+
SET event_count=rollup_events_5min.event_count+excluded.event_count,
29+
device_distinct_count = hll_union(rollup_events_5min.device_distinct_count, excluded.device_distinct_count),
30+
session_distinct_count= hll_union(rollup_events_5min.session_distinct_count, excluded.session_distinct_count),
31+
top_devices_1000 = topn_union(rollup_events_5min.top_devices_1000, excluded.top_devices_1000);
3132

3233
END;
3334
$function$;

0 commit comments

Comments
 (0)