Improve performance of Search API (Advanced): projects scope
Summary
In &3166 (closed) a performance issue was raised around the response time of the Advanced Search API. This issue deals specifically with the projects
scope, at the Global and Group levels. Below are results of a performance test that was run on the 10k reference architecture:
API - Global Search
✓ { endpoint:projects }.........: avg=12526.72ms min=119.62ms med=15190.05ms max=17687.90ms p(90)=16748.14ms p(95)=16930.75ms
API - Group Search
✓ { endpoint:projects }.........: avg=7831.71ms min=675.98ms med=7216.08ms max=19758.95ms p(90)=13552.16ms p(95)=15999.05ms
Improvements
Global
Queries
Started GET "/api/v4/search?scope=projects&search=*" for 127.0.0.1 at 2020-04-24 17:46:12 -0400
PersonalAccessToken Load (0.3ms) SELECT "personal_access_tokens".* FROM "personal_access_tokens" WHERE "personal_access_tokens"."token_digest" = 'aOBZCX5QVmjx6CXZHtDEgZx8PNZ/AbO5LAJWVpcFVko=' LIMIT 1
↳ app/models/concerns/token_authenticatable_strategies/digest.rb:8:in `find_token_authenticatable'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
↳ lib/gitlab/auth/auth_finders.rb:103:in `find_user_from_access_token'
License Load (0.2ms) SELECT "licenses".* FROM "licenses" ORDER BY "licenses"."id" DESC LIMIT 1
↳ ee/app/models/license.rb:268:in `load_license'
Project Search (6.7ms) {index: "gitlab-development", type: "doc", body: {query: {bool: {must: [{simple_query_string: {fields: ["name^10", "name_with_namespace^2", "path_with_namespace", "path^9", "description"], query: "*", default_operator: :and}}], filter: [{terms: {type: ["project"]}}, {bool: {should: [{term: {visibility_level: 0}}, {term: {visibility_level: 10}}, {term: {visibility_level: 20}}]}}]}}, sort: [:_score], highlight: {fields: {name: {}, name_with_namespace: {}, path_with_namespace: {}, path: {}, description: {}}}}, size: 20, from: 0}
(0.7ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."id" IN (3, 9, 16, 17, 8, 6, 4, 1, 2, 10, 14, 15, 5, 7, 13, 18, 20, 12, 11, 19)
↳ ee/lib/gitlab/elastic/search_results.rb:172:in `eager_load'
Project Load (0.7ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" IN (3, 9, 16, 17, 8, 6, 4, 1, 2, 10, 14, 15, 5, 7, 13, 18, 20, 12, 11, 19)
↳ ee/lib/gitlab/elastic/search_results.rb:172:in `eager_load'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_type" = 'Project' AND "routes"."source_id" IN (2, 1, 4, 3, 8, 9, 7, 13, 10, 14, 11, 5, 6, 15, 12, 16, 20, 19, 17, 18)
↳ ee/lib/gitlab/elastic/search_results.rb:172:in `eager_load'
Namespace Load (0.5ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."id" IN (22, 24, 23, 28, 34, 27, 29, 14, 15, 43, 25, 26, 4, 10, 7, 53, 1, 41, 8)
↳ ee/lib/gitlab/elastic/search_results.rb:172:in `eager_load'
ComplianceManagement::ComplianceFramework::ProjectSettings Load (0.3ms) SELECT "project_compliance_framework_settings".* FROM "project_compliance_framework_settings" WHERE "project_compliance_framework_settings"."project_id" IN (2, 1, 4, 3, 8, 9, 7, 13, 10, 14, 11, 5, 6, 15, 12, 16, 20, 19, 17, 18)
↳ ee/lib/gitlab/elastic/search_results.rb:172:in `eager_load'
Group Load (0.5ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 8 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 22 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 22
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 24 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 24
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 24 AND "namespaces"."parent_id" IS NULL LIMIT 1
↳ app/models/namespace.rb:285:in `block in root_ancestor'
Group Load (0.5ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 23 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 23
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 28 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 28
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 34 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 27 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 27
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.5ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 29 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 14 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 15 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 43 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 25 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 25
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 26 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 26
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 4 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 10 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 7 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 53 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 53
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 1 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 41 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
Group Load (0.4ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 22 AND "namespaces"."type" = 'Group' LIMIT 1
↳ ee/app/policies/ee/project_policy.rb:308:in `block (2 levels) in <module:ProjectPolicy>'
IpRestriction Load (0.2ms) SELECT "ip_restrictions".* FROM "ip_restrictions" WHERE "ip_restrictions"."group_id" = 22
↳ ee/lib/gitlab/ip_restriction/enforcer.rb:31:in `allows_address?'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 18 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 18 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 8 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 8 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 1 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 1 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 22 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 4 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 24 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 3 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 23 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 8 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 8 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 28 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 9 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 9 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 34 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 27 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 7 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 27 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 13 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 13 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 29 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 22 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 10 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 10 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 14 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 14 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 14 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 14 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 15 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 15 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 11 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 11 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 43 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 36 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 5 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 25 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 6 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 26 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 15 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 15 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 4 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 12 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 12 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 10 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 10 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 16 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 16 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 7 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 7 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 20 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 20 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 53 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 19 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 19 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 1 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ProjectFeature Load (0.3ms) SELECT "project_features".* FROM "project_features" WHERE "project_features"."project_id" = 17 LIMIT 1
↳ app/policies/project_policy.rb:539:in `feature_available?'
ActsAsTaggableOn::Tag Load (0.4ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 17 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
Route Load (0.3ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 41 AND "routes"."source_type" = 'Namespace' LIMIT 1
↳ app/models/concerns/routable.rb:77:in `full_path'
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 34 LIMIT 1
↳ app/models/namespace.rb:59:in `avatar_url'
ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 2 AND "taggings"."taggable_type" = 'Project' AND "taggings"."context" = 'tags' ORDER BY taggings.id
↳ lib/api/entities/basic_project_details.rb:15:in `map'
102 queries performed, with N+1 queries observed for:
- namespaces
- ip_restrictions
- project_features
- tags
- routes
- users
Optimizing this will also improve Group and Project levels, as they do not override eager-loading behaviour.
Edited by 🤖 GitLab Bot 🤖