-
- Downloads
Eliminate N+1 queries in /api/groups/:id
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15475/diffs, a significant amount of work went into eliminating N+1 queries in the /api/groups/:id/projects endpoint. We can reuse the `Entities::Project.prepare_relation` call on the projects. In a group with 2,573 projects on GitLab.com, this change significantly improves performance: * 18019 SQL queries down to 21 * Time spent in DB: 70 s down to 384 ms Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/49845
Showing
- changelogs/unreleased/sh-preload-associations-for-group-api.yml 5 additions, 0 deletions...logs/unreleased/sh-preload-associations-for-group-api.yml
- lib/api/entities.rb 6 additions, 2 deletionslib/api/entities.rb
- spec/requests/api/groups_spec.rb 14 additions, 0 deletionsspec/requests/api/groups_spec.rb
Please register or sign in to comment