Skip to content

Instantly share code, notes, and snippets.

@morsapaes
Last active October 7, 2021 09:43
Show Gist options
  • Save morsapaes/834e40f582e799896ae17c4f5adfffb5 to your computer and use it in GitHub Desktop.
Save morsapaes/834e40f582e799896ae17c4f5adfffb5 to your computer and use it in GitHub Desktop.
Analyzing Twitch streams with Materialize: what are the most popular games?
CREATE MATERIALIZED VIEW mv_agg_stream_game AS
SELECT game_id,
game_name,
COUNT(id) AS cnt_streams,
SUM(viewer_count) AS agg_viewer_cnt
FROM v_twitch_stream
WHERE game_id IS NOT NULL
GROUP BY game_id, game_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment