Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cad6bb36
Commit
cad6bb36
authored
Mar 23, 2021
by
Terri Chu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preload group.parent for project scope searches
parent
572bb8c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
app/models/project.rb
app/models/project.rb
+1
-1
changelogs/unreleased/fix-n-1-for-project-scope.yml
changelogs/unreleased/fix-n-1-for-project-scope.yml
+5
-0
No files found.
app/models/project.rb
View file @
cad6bb36
...
@@ -623,7 +623,7 @@ class Project < ApplicationRecord
...
@@ -623,7 +623,7 @@ class Project < ApplicationRecord
end
end
def
self
.
with_web_entity_associations
def
self
.
with_web_entity_associations
preload
(
:project_feature
,
:route
,
:creator
,
:group
,
namespace:
[
:route
,
:owner
])
preload
(
:project_feature
,
:route
,
:creator
,
group: :parent
,
namespace:
[
:route
,
:owner
])
end
end
def
self
.
eager_load_namespace_and_owner
def
self
.
eager_load_namespace_and_owner
...
...
changelogs/unreleased/fix-n-1-for-project-scope.yml
0 → 100644
View file @
cad6bb36
---
title
:
Preload group parent to fix N+1 queries for project search
merge_request
:
57277
author
:
type
:
performance
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment