APPENDIX · P5 · MATERIALIZED VIEW · GO TO SLIDE 17
← Back to the slide17
P5. Reading the MV unit
SELECT day, uniqMerge(players) AS dau,
sum(damage) AS damage
FROM daily_stats
WHERE day >= '2026-09-28'
GROUP BY day
ORDER BY day;
SELECT count() FROM daily_stats;
What the result should be
day dau damage
2026-09-28 55983 2691724
2026-09-29 56055 2684592
2026-09-30 55953 2665714
2026-10-01 63126 3264955
186 // строк в агрегате
uniqMerge
GROUP BY is required
186 lines
The uniqState values for the three modes are combined: a player in two modes is counted only once.
Rows from the same day may appear in different sections: without GROUP BY, these are partial aggregates.
62 days × 3 modes instead of 5.1 million events: the dashboard reads thousands of times fewer rows.
The sum of DAU by day ≠ unique users per week. WAU is calculated by uniqMerge across all days of the week, not by summing the daily figures.