fixed reltive last comments
This commit is contained in:
@@ -6,11 +6,12 @@
|
||||
|
||||
CREATE MATERIALIZED VIEW IF NOT EXISTS dm.lesson_popularity_summary AS
|
||||
-- EXPLAIN ANALYZE
|
||||
DISTRIBUTED BY (lesson_id, course_id)
|
||||
WITH t1 AS (
|
||||
SELECT
|
||||
lesson_id,
|
||||
course_id,
|
||||
COUNT(lesson_id) AS total_views,
|
||||
COUNT(*) AS total_views,
|
||||
COUNT(DISTINCT user_id) AS unique_users,
|
||||
MIN(viewed_at)AS first_view,
|
||||
MAX(viewed_at)AS last_view
|
||||
@@ -25,8 +26,8 @@ SELECT
|
||||
c.title AS course_title
|
||||
FROM core.dim_course c
|
||||
LEFT JOIN core.dim_lesson l USING(course_id)
|
||||
|
||||
)
|
||||
|
||||
SELECT
|
||||
t1.lesson_id,
|
||||
t2.lesson_title,
|
||||
@@ -37,6 +38,5 @@ SELECT
|
||||
t1.first_view,
|
||||
t1.last_view
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(lesson_id)
|
||||
LEFT JOIN t2 USING(lesson_id, course_id);
|
||||
|
||||
DISTRIBUTED BY (lesson_id, course_id);
|
||||
Reference in New Issue
Block a user