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

Speed up events endpoint #903

Merged
merged 2 commits into from
Jun 3, 2020
Merged

Speed up events endpoint #903

merged 2 commits into from
Jun 3, 2020

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Jun 1, 2020

Changes

  • When hitting the /events endpoint, try initially just hitting this week's partitions.
    This massively speeds up large instances:
    Original:
    image
    PR:
    image
    The difference will be even more pronounced on bigger instances.
  • Add url to the "next" property for pagination instead of just a bool to be consistent with other endpoints

Checklist

  • All querysets/queries filter by Team (if applicable)
  • Backend tests (if applicable)

@timgl timgl temporarily deployed to posthog-speed-up-events-gllltg June 1, 2020 17:53 Inactive
@timgl timgl temporarily deployed to posthog-speed-up-events-gllltg June 2, 2020 09:35 Inactive
@timgl timgl requested a review from EDsCODE June 2, 2020 11:05
return response.Response({
'next': len(events) > 100,
'next': next_url,
Copy link
Member

@EDsCODE EDsCODE Jun 2, 2020

Choose a reason for hiding this comment

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

Did you mean to change how eventtablelogic works? This URL looks good but the table logic doesn't use it yet because before it was just a boolean. Either way it's good to go

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't part of this ticket so I'll get this in and come back to that.

@timgl timgl merged commit 9be3645 into master Jun 3, 2020
@timgl timgl deleted the speed-up-events-endpoint branch June 3, 2020 16:11
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