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

Simplify action queries #2167

Merged
merged 12 commits into from
Nov 3, 2020
Merged

Simplify action queries #2167

merged 12 commits into from
Nov 3, 2020

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Nov 2, 2020

Changes

We were using a ton of uuid IN (SELECT uuid FROM events {bla}). This gets rid of those. Should also make all those queries faster.

Checklist

  • All querysets/queries filter by Organization, Team, and User (if this PR affects ANY querysets/queries).
  • Django backend tests (if this PR affects the backend).
  • Cypress end-to-end tests (if this PR affects the frontend).

@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 12:11 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 12:20 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 13:43 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 14:13 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 14:19 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 14:26 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 14:47 Inactive
@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 2, 2020 15:00 Inactive
@timgl timgl changed the title Simplify funnel and action query Simplify action queries Nov 2, 2020
@timgl timgl requested a review from EDsCODE November 2, 2020 15:03
@timgl timgl marked this pull request as ready for review November 2, 2020 15:15
or_separator = (
") OR (" if not use_loop else ") OR uuid IN (SELECT uuid FROM events WHERE team_id = %(team_id)s AND "
)
if use_loop:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: for clarity can just put the or_separator under the respective if condition. The ternary above is the same as this if statement

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@timgl timgl temporarily deployed to posthog-simplify-funnel-pp7lck November 3, 2020 11:49 Inactive
@timgl timgl merged commit a07eed7 into master Nov 3, 2020
@timgl timgl deleted the simplify-funnels branch November 3, 2020 15:06
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.

None yet

2 participants