Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hogql): mixed PoE mode #18064

Merged
merged 2 commits into from
Oct 20, 2023
Merged

feat(hogql): mixed PoE mode #18064

merged 2 commits into from
Oct 20, 2023

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented Oct 18, 2023

Problem

I've been told we can speed up queries that rely on ingestion-time person properties without the full PoE rollout, by just exposing person_properties.

Changes

Introduces a v1_mixed PoE mode, where properties are taken from the event, but the other fields come via joins.

This only works on HogQL queries.

query = "SELECT event, person.id, person.properties, person.created_at FROM events"

test_cases = [
    (
        PersonsOnEventsMode.disabled, # all joined
        "events.event",
        "events__pdi__person.id",
        "events__pdi__person.properties",
        "toTimeZone(events__pdi__person.created_at, %(hogql_val_0)s)",
    ),
    (
        PersonsOnEventsMode.v1_enabled, # all direct
        "events.event",
        "events.person_id",
        "events.person_properties",
        "toTimeZone(events.person_created_at, %(hogql_val_0)s)",
    ),
    (
        PersonsOnEventsMode.v1_mixed,  # properties direct
        "events.event",
        "events__pdi.person_id",
        "events.person_properties",
        "toTimeZone(events__pdi__person.created_at, %(hogql_val_0)s)",
    ),
]
image

How did you test this code?

Added tests to document the new behaviour. It's disabled by default, but we could play with it under /debug and try if it makes a difference for real clients.

@mariusandra mariusandra merged commit ee0fc55 into master Oct 20, 2023
@mariusandra mariusandra deleted the mixed-poe-mode branch October 20, 2023 09:04
daibhin pushed a commit that referenced this pull request Oct 23, 2023
* feat(hogql): mixed poe mode

* schema
Justicea83 pushed a commit to Justicea83/posthog that referenced this pull request Oct 25, 2023
* feat(hogql): mixed poe mode

* schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants