mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 00:47:50 +01:00
wip: pagination for persons on clickhouse funnels
This commit is contained in:
parent
8d90b00c99
commit
537bdb3d27
@ -22,3 +22,32 @@ GROUP BY max_step {top_level_groupby}
|
||||
ORDER BY max_step {top_level_groupby} ASC
|
||||
;
|
||||
"""
|
||||
|
||||
FUNNEL_PERSONS_SQL = """
|
||||
SELECT max_step {top_level_groupby}, count(1) as cnt, id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
pid.person_id as id,
|
||||
{extra_select}
|
||||
windowFunnel({within_time})(toUInt64(toUnixTimestamp64Micro(timestamp)),
|
||||
{steps}
|
||||
) as max_step
|
||||
FROM
|
||||
events
|
||||
JOIN (
|
||||
SELECT person_id, distinct_id FROM ({latest_distinct_id_sql}) WHERE team_id = %(team_id)s
|
||||
) as pid
|
||||
ON pid.distinct_id = events.distinct_id
|
||||
WHERE
|
||||
team_id = %(team_id)s {filters} {parsed_date_from} {parsed_date_to}
|
||||
AND event IN %(events)s
|
||||
GROUP BY pid.person_id {extra_groupby}
|
||||
)
|
||||
WHERE max_step = {current_step}
|
||||
GROUP BY max_step, id {top_level_groupby}
|
||||
ORDER BY max_step {top_level_groupby} ASC
|
||||
limit 50
|
||||
offset {offset}
|
||||
;
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user