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

Remove unnecessary groupbys in session queries #3562

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Mar 2, 2021

Changes

Please describe.

  • the innermost section in session queries have a groupby that doesn't seem to be achieving anything
  • this optimizes the runtime of the sessions queries

If this affects the frontend, include screenshots.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests

@timgl timgl temporarily deployed to posthog-remove-groupby--u4ma2f March 2, 2021 23:19 Inactive
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

I guess the group bys are there to prevent duplicate events (same uuid) from being counted twice?

I think it's fine to remove, yet I've been away from these queries for a while now and I'm hesitant to be 100% confident in my approval.

@EDsCODE
Copy link
Member Author

EDsCODE commented Mar 3, 2021

Yeah I think in theory it shouldve been deduping if necessary, but I ran some counts to compare if it actually has any effect and doesn't seem to be changing anything with the results.

@EDsCODE EDsCODE merged commit fcf7c98 into master Mar 3, 2021
@EDsCODE EDsCODE deleted the remove-groupby-session-queries branch March 3, 2021 15:14
@timgl
Copy link
Collaborator

timgl commented Mar 4, 2021

These may have been necessary: #3566 (comment)

@mariusandra
Copy link
Collaborator

Yep, they probably were. The tests started flaking after that, though surprisingly sometimes pass fully. This is what I consistently get when running the tests locally:

image

@timgl
Copy link
Collaborator

timgl commented Mar 4, 2021

Yep, I'll fix this right now

@mariusandra
Copy link
Collaborator

Yep, this should be reverted. After adding back the groupbys, all tests went green

@timgl
Copy link
Collaborator

timgl commented Mar 4, 2021

I'm not going to revert it but one sec!

@timgl
Copy link
Collaborator

timgl commented Mar 4, 2021

#3580

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.

3 participants