Skip to content

Instantly share code, notes, and snippets.

@morsapaes
Created April 25, 2022 10:23
Show Gist options
  • Save morsapaes/e985d2dca09852f4fb2607157ade3394 to your computer and use it in GitHub Desktop.
Save morsapaes/e985d2dca09852f4fb2607157ade3394 to your computer and use it in GitHub Desktop.
CREATE MATERIALIZED VIEW tweets_hourly AS
SELECT
date_bin(interval '1 hours', created_at, '2022-03-22') AS time_bucket,
COUNT(tweet_id) AS total_tweets
FROM twitter_tweets
GROUP BY 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment