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

Solve n+1 queries problem in user feed #1

Merged
merged 2 commits into from
Dec 13, 2022
Merged

Conversation

razvan-secure
Copy link
Owner

Fixes: Improve scores feed performance #1

Changes

Changed from lazy loading in user_feed method to eager loading to prevent making a separate database query for each score in a user's feed.

Before

Making n+1 queries, one for each user.

Screenshot 2022-12-12 at 13 14 42

After

Getting all users at once with a single query.

Screenshot 2022-12-12 at 13 12 44

@razvan-secure razvan-secure merged commit 214b0b2 into main Dec 13, 2022
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.

Improve scores feed performance
2 participants