Skip to content

Instantly share code, notes, and snippets.

@sbaltus
Created January 27, 2018 18:57
Show Gist options
  • Select an option

  • Save sbaltus/c69efc0d7ca2ffe323fa5613f1964d85 to your computer and use it in GitHub Desktop.

Select an option

Save sbaltus/c69efc0d7ca2ffe323fa5613f1964d85 to your computer and use it in GitHub Desktop.
Create Materialized view
CREATE MATERIALIZED VIEW IF NOT EXISTS job_offer_views_mv AS
SELECT job_offer_id
 , COUNT(*) AS view_count
 , COUNT(distinct session_id) AS unique_view_count
FROM views 
GROUP BY job_offer_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment