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

Fix n+1 in search show page #1436

Merged
merged 1 commit into from
Nov 2, 2016
Merged

Conversation

sonalkr132
Copy link
Member

This won't have any noticeable effect on /api/v1/search. In api search it would only make one fewer sql query per record because gem_download for gem.latest_version is now eager loaded.

On search show page this makes 60 fewer calls to database(2 per record).

with_versions is expendable because the search condition already uses versions.indexed in its condition.

@sonalkr132
Copy link
Member Author

sonalkr132 commented Oct 1, 2016

Even after this patch search api would be making 4 db calls for each rubygem. It is mostly because rubygems payload is huge(there are 30 such rubygems in single response). It is too expensive to expose that many attributes. I think I will fix this with AMS.

@indirect indirect merged commit f7a8cc4 into rubygems:master Nov 2, 2016
@sonalkr132 sonalkr132 deleted the search_perf branch November 4, 2016 17:34
@rubygems-deployer rubygems-deployer temporarily deployed to staging November 5, 2016 14:31 Inactive
@dwradcliffe dwradcliffe temporarily deployed to production November 5, 2016 15:16 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants