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

Improved feed performance #1

Merged
merged 12 commits into from
Jan 6, 2022

Conversation

alexandru-nedelcu01
Copy link
Owner

@alexandru-nedelcu01 alexandru-nedelcu01 commented Jan 6, 2022

Fixes: AACraiu#1

Changes

Loaded all the scores and their associated users in the same database query.

scores = Score.all.includes(:user).order(played_at: :desc, id: :desc)

This avoids hitting the database each time the user associated with a certain score is needed.


Before

before


After
after

@alexandru-nedelcu01 alexandru-nedelcu01 changed the title Improved feed performance by solving the n+1 queries issue Improved feed performance Jan 6, 2022
@SergiuApostuTOL SergiuApostuTOL merged commit 7191ff4 into develop Jan 6, 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.

3 participants