Оптимизация MV: замена NOT IN на ANTI JOIN
This commit is contained in:
@@ -136,6 +136,8 @@ GROUP BY
|
|||||||
flv.course_id,
|
flv.course_id,
|
||||||
c.title;
|
c.title;
|
||||||
|
|
||||||
|
DROP VIEW IF EXISTS ybirk.mv_inactive_users_summary ON CLUSTER clickhouse_cluster;
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW ybirk.mv_inactive_users_summary ON CLUSTER clickhouse_cluster
|
CREATE MATERIALIZED VIEW ybirk.mv_inactive_users_summary ON CLUSTER clickhouse_cluster
|
||||||
TO ybirk.inactive_users_summary
|
TO ybirk.inactive_users_summary
|
||||||
AS
|
AS
|
||||||
@@ -148,10 +150,7 @@ SELECT
|
|||||||
u.registration_date AS registration_date
|
u.registration_date AS registration_date
|
||||||
FROM ybirk.core_user AS u
|
FROM ybirk.core_user AS u
|
||||||
LEFT JOIN ybirk.core_enrollments AS e ON u.user_id = e.user_id
|
LEFT JOIN ybirk.core_enrollments AS e ON u.user_id = e.user_id
|
||||||
WHERE u.user_id NOT IN (
|
LEFT ANTI JOIN ybirk.core_fact_lesson_views AS flv ON u.user_id = flv.user_id
|
||||||
SELECT DISTINCT user_id
|
|
||||||
FROM ybirk.core_fact_lesson_views
|
|
||||||
)
|
|
||||||
GROUP BY
|
GROUP BY
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.name,
|
u.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user