0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/ee/clickhouse/queries/trends
Karl-Aksel Puulmann d9bc06b7dd
Speed up lifecycle query (#8021)
* refactor(lifecycle): simplify clickhouse sql logic

This updates the SQL to be comprised of two queries, one for getting
new, returning, and resurrecting periods of activity, one for getting
dormant periods right after periods of activity.

Refers to https://github.com/PostHog/posthog/issues/7382

* refactor(lifecyle): use `ClickhouseEventQuery` to build event query

* format

* Use bounded_person_activity_by_period for both sides of dormant join

* refactor(lifecycle): reduce pdi2 join by one

This means we're now under the current query memory limit for orgs with
around 20m distinct_ids. It does remove some readability though :(

* update snapshot

* Add further comments to query

* Add further comments to query

* Add further comments to query

* Remove dead variables

* Refactor person_query overriding

* Lifecycle refactoring continued

* Update lifecycle tests (except people ones)

* Make lifecycle people endpoint happy

* Remove django lifecycle tests

* Add some edge case tests

* Add missing type

Co-authored-by: Harry Waye <harry@posthog.com>
2022-01-13 16:31:09 +02:00
..
test Related groups query refactor (#7978) 2022-01-12 13:15:43 +02:00
__init__.py
breakdown.py Speed up person_distinct_id queries for select clients (#7577) 2021-12-08 15:59:41 +02:00
clickhouse_trends.py Don't capture error messages for trends (#7557) 2021-12-07 16:55:33 +00:00
formula.py
lifecycle.py Speed up lifecycle query (#8021) 2022-01-13 16:31:09 +02:00
person.py Related groups query refactor (#7978) 2022-01-12 13:15:43 +02:00
total_volume.py [group actors] Trends and funnels actors UI (#7298) 2021-12-02 10:02:23 +02:00
trend_event_query.py Speed up lifecycle query (#8021) 2022-01-13 16:31:09 +02:00
util.py Remove "minute" interval (#7847) 2022-01-05 13:11:58 +02:00