You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparing this to the actual SQL I'd write to get these results:
reading_time_all_allocated <- dbGetQuery(con, glue(
"WITH cohorts AS ( SELECT p.variation, p.userid, DATE(MIN(p.ts)) AS enrolment_date FROM p_experiments p WHERE p.experimentid = '{experiment_id}' AND p.name LIKE '%variation::select%' AND p.userid IS NOT NULL AND p.ts BETWEEN '{date_start}' AND '{date_end}' AND p.variation != 'unknown' GROUP BY p.variation, p.userid),reading_time AS ( SELECT c.userid, c.variation, COALESCE(SUM(er.time_spent), 0) AS rt FROM etl_reading er JOIN cohorts c ON er.userid = c.userid WHERE er.createdate >= c.enrolment_date AND er.createdate BETWEEN '{date_start}' AND ('{date_end}' - INTEGER '1') AND er.time_spent >= 0 GROUP BY c.userid, c.variation)SELECT c.userid, c.variation, COALESCE(r.rt, 0) AS rt FROM cohorts c LEFT OUTER JOIN reading_time r ON c.userid = r.userid AND c.variation = r.variation",
experiment_id = experiment_id,
date_start = date_start,
date_end = date_end))
Probably because of the extra subqueries inside the joins.
The text was updated successfully, but these errors were encountered:
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
lockbot
locked and limited conversation to collaborators
Dec 5, 2018
This issue was closed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
produces this SQL (via explain()):
Comparing this to the actual SQL I'd write to get these results:
Probably because of the extra subqueries inside the joins.
The text was updated successfully, but these errors were encountered: