Rewrite the Lifecycle Insight in HogQL
Is your feature request related to a problem?
This is part of the push to rewrite all insights in HogQL. I've created separate issues for each insight type, so that users can subscribe here and get notified when it's done.
This issue is about the Lifecycle insight.
Describe the solution you'd like
I'd like to rewrite the Lifecycle Insight in HogQL.
-
Most product analytics insights are built in a bespoke way in our "legacy" Python codebase. This code produces ClickHouse SQL as its output. It's hard to extend, as every new feature (e.g. group support, multiple breakdowns) needs to be manually added to each insight. It's hard to extend the current system, and there are many bugs and unimplemented edge case features.
-
We've built HogQL, which takes care of implementation details, and lets users focus on writing queries. Every platform feature added to HogQL (e.g. group support, new aggregations, etc) will automatically be available in every insight everywhere.
-
We're now rewriting our python codebase to output HogQL instead of ClickHouse SQL. This will fix whole classes of bugs, make the system more robust, and allow the end user to directly modify the generated HogQL SQL for further analysis.
-
This migration is also a blocker for the removal of a lot of legacy frontend code, which is often causing bugs.
Additional context
See the latest todo list in the megaissue: https://github.com/PostHog/meta/issues/130
The HogQL lifecycle query has been released to all users!
In addition to the new "explore (further)" button in the persons modal, we also got for free filtering by group properties, and weeks that start on Sundays.
We're also unblocked in improving this query further. For example, we could now actually prioritise and them implement breakdowns in this insights. Stay tuned while we port the other 5 insights and then return for upgrades.
One more request: https://github.com/PostHog/posthog/issues/20291#issuecomment-1943725284
Group support has now been added to the lifecycle insight!
Closing this. We'll track new feature requests in the combined issue here: https://github.com/PostHog/meta/issues/200