Remove N+1 on `plans` in member roles preloader
What does this MR do and why?
This change reproduces an N+1 issues that occurs in the Preloaders::UserMemberRolesInProjectsPreloader
. This issue occurs when the should_check_namespace_plan
is enabled and the custom_roles
feature is globally enabled.
Additional context can be found in: #421024 (comment 1743106849)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before:
Local Development Environment
SELECT DISTINCT "plans".* FROM "plans" INNER JOIN "gitlab_subscriptions" ON "gitlab_subscriptions"."hosted_plan_id" = "plans"."id" WHERE "plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource') AND "gitlab_subscriptions"."namespace_id" = 71 /*application:web,correlation_id:01HNBTQT0T1H1CWRBGE60NY8M8,endpoint_id:SearchController#show,db_config_name:main,line:/ee/app/models/ee/namespace.rb:228:in `map'*/
Role: Primary
Config name: main
[
"lib/peek/views/active_record.rb:55:in `block in setup_subscribers'",
"ee/app/models/ee/namespace.rb:228:in `map'",
"ee/app/models/ee/namespace.rb:228:in `block (2 levels) in feature_available_in_plan?'",
"ee/app/models/ee/namespace.rb:232:in `feature_available_in_plan?'",
"ee/app/models/ee/namespace.rb:641:in `load_feature_available'",
"ee/app/models/ee/namespace.rb:218:in `block (2 levels) in licensed_feature_available?'",
"ee/app/models/ee/namespace.rb:222:in `licensed_feature_available?'",
"ee/app/models/ee/namespace.rb:568:in `custom_roles_enabled?'",
"ee/app/models/ee/project.rb:437:in `custom_roles_enabled?'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:98:in `custom_roles_enabled_on?'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:40:in `block in abilities_for_user_grouped_by_project'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:39:in `filter_map'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:39:in `abilities_for_user_grouped_by_project'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:32:in `block in execute'",
"lib/gitlab/safe_request_loader.rb:43:in `update_resource_data'",
"lib/gitlab/safe_request_loader.rb:22:in `execute'",
"lib/gitlab/safe_request_loader.rb:6:in `execute'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:28:in `execute'",
"ee/lib/elastic/latest/git_class_proxy.rb:50:in `abilities_for'",
"ee/lib/elastic/latest/git_class_proxy.rb:57:in `filter_ids_by_ability'",
"ee/lib/elastic/latest/git_class_proxy.rb:67:in `filter_ids_by_feature'",
"ee/lib/elastic/latest/application_class_proxy.rb:378:in `rejected_project_filter'",
"ee/lib/elastic/latest/application_class_proxy.rb:484:in `block in traversal_ids_filter'",
"ee/lib/elastic/latest/query_context.rb:25:in `name'",
"ee/lib/elastic/latest/application_class_proxy.rb:482:in `traversal_ids_filter'",
"ee/lib/elastic/latest/application_class_proxy.rb:510:in `authorization_filter'",
"ee/lib/elastic/latest/git_class_proxy.rb:321:in `block in blob_query'",
"ee/lib/elastic/latest/query_context.rb:25:in `name'",
"ee/lib/elastic/latest/git_class_proxy.rb:320:in `blob_query'",
"ee/lib/elastic/latest/git_class_proxy.rb:187:in `search_blob'",
"ee/lib/elastic/latest/git_class_proxy.rb:19:in `elastic_search'",
"ee/lib/elastic/latest/git_class_proxy.rb:200:in `elastic_search_and_wrap'",
"ee/lib/elastic/latest/git_class_proxy.rb:28:in `elastic_search_as_found_blob'",
"ee/lib/elastic/multi_version_util.rb:76:in `elastic_search_as_found_blob'",
"ee/lib/gitlab/elastic/search_results.rb:372:in `block in blobs'",
"ee/lib/gitlab/elastic/search_results.rb:371:in `blobs'",
"ee/lib/gitlab/elastic/search_results.rb:46:in `objects'",
"app/services/search_service.rb:68:in `search_objects'",
"app/presenters/search_service_presenter.rb:25:in `search_objects'",
"app/controllers/search_controller.rb:71:in `block in show'",
"app/controllers/search_controller.rb:68:in `show'",
"app/controllers/application_controller.rb:517:in `block in allow_gitaly_ref_name_caching'",
"lib/gitlab/gitaly_client.rb:472:in `allow_ref_name_caching'",
"app/controllers/application_controller.rb:516:in `allow_gitaly_ref_name_caching'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'",
"ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'",
"app/controllers/application_controller.rb:468:in `set_current_admin'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:459:in `set_session_storage'",
"app/controllers/application_controller.rb:450:in `set_locale'",
"app/controllers/application_controller.rb:443:in `set_current_context'",
"ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase'",
"lib/gitlab/database/query_analyzer.rb:40:in `within'"
]
Production Environment
SELECT DISTINCT "plans".* FROM "plans" INNER JOIN "gitlab_subscriptions" ON "gitlab_subscriptions"."hosted_plan_id" = "plans"."id" WHERE "plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource') AND "gitlab_subscriptions"."namespace_id" = 6543
Cached
Role: Replica
Config name: main_replica
[
"lib/peek/views/active_record.rb:55:in `block in setup_subscribers'",
"ee/app/models/ee/namespace.rb:226:in `map'",
"ee/app/models/ee/namespace.rb:226:in `block (2 levels) in feature_available_in_plan?'",
"ee/app/models/ee/namespace.rb:230:in `feature_available_in_plan?'",
"ee/app/models/ee/namespace.rb:639:in `load_feature_available'",
"ee/app/models/ee/namespace.rb:216:in `block (2 levels) in licensed_feature_available?'",
"ee/app/models/ee/namespace.rb:220:in `licensed_feature_available?'",
"ee/app/models/ee/namespace.rb:566:in `custom_roles_enabled?'",
"ee/app/models/ee/project.rb:434:in `custom_roles_enabled?'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:37:in `block in abilities_for_user_grouped_by_project'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:36:in `filter_map'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:36:in `abilities_for_user_grouped_by_project'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:29:in `block in execute'",
"lib/gitlab/safe_request_loader.rb:43:in `update_resource_data'",
"lib/gitlab/safe_request_loader.rb:22:in `execute'",
"lib/gitlab/safe_request_loader.rb:6:in `execute'",
"ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:25:in `execute'",
"ee/lib/elastic/latest/git_class_proxy.rb:50:in `abilities_for'",
"ee/lib/elastic/latest/git_class_proxy.rb:57:in `filter_ids_by_ability'",
"ee/lib/elastic/latest/git_class_proxy.rb:67:in `filter_ids_by_feature'",
"ee/lib/elastic/latest/application_class_proxy.rb:378:in `rejected_project_filter'",
"ee/lib/elastic/latest/application_class_proxy.rb:484:in `block in traversal_ids_filter'",
"ee/lib/elastic/latest/query_context.rb:25:in `name'",
"ee/lib/elastic/latest/application_class_proxy.rb:482:in `traversal_ids_filter'",
"ee/lib/elastic/latest/application_class_proxy.rb:510:in `authorization_filter'",
"ee/lib/elastic/latest/git_class_proxy.rb:321:in `block in blob_query'",
"ee/lib/elastic/latest/query_context.rb:25:in `name'",
"ee/lib/elastic/latest/git_class_proxy.rb:320:in `blob_query'",
"ee/lib/elastic/latest/git_class_proxy.rb:187:in `search_blob'",
"ee/lib/elastic/latest/git_class_proxy.rb:19:in `elastic_search'",
"ee/lib/elastic/latest/git_class_proxy.rb:200:in `elastic_search_and_wrap'",
"ee/lib/elastic/latest/git_class_proxy.rb:28:in `elastic_search_as_found_blob'",
"ee/lib/elastic/multi_version_util.rb:76:in `elastic_search_as_found_blob'",
"ee/lib/gitlab/elastic/search_results.rb:372:in `block in blobs'",
"ee/lib/gitlab/elastic/search_results.rb:371:in `blobs'",
"ee/lib/gitlab/elastic/search_results.rb:46:in `objects'",
"app/services/search_service.rb:68:in `search_objects'",
"app/presenters/search_service_presenter.rb:25:in `search_objects'",
"app/controllers/search_controller.rb:71:in `block in show'",
"app/controllers/search_controller.rb:68:in `show'",
"app/controllers/application_controller.rb:517:in `block in allow_gitaly_ref_name_caching'",
"lib/gitlab/gitaly_client.rb:472:in `allow_ref_name_caching'",
"app/controllers/application_controller.rb:516:in `allow_gitaly_ref_name_caching'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'",
"ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'",
"app/controllers/application_controller.rb:468:in `set_current_admin'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:459:in `set_session_storage'",
"app/controllers/application_controller.rb:450:in `set_locale'",
"app/controllers/application_controller.rb:443:in `set_current_context'",
"ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase'",
"lib/gitlab/database/query_analyzer.rb:40:in `within'"
]
After
Local Development Environment
How to set up and validate locally
- Enable elastic search.
gdk config set elasticsearch.enabled true && gdk reconfigure && gdk restart
bundle exec rake gitlab:elastic:index
- Enable the
search_filter_by_ability
feature flag. (e.g.Feature.enable(:search_filter_by_ability)
) - Enable SaaS mode
export GITLAB_SIMULATE_SAAS=1
. - Enable
EE::ApplicationSetting#should_check_namespace_plan?
. - Create a group hierarchy with projects in different layers of the group hierarchy.
-
Create a custom role with
:read_code
enabled. - Invite a user to a group with the role created in the previous step.
- Login as the new user.
- Search for code at the group level.
- Verify that search results are shown.
With the following hierarchy:
[38] pry(main)> Group.find(71).children
[#<Group id:80 @gitlab-examples/demo-group>, #<Group id:72 @gitlab-examples/security>]
[39] pry(main)> Project.where(namespace_id: Group.find(71).children)
[
#<Project id:27 gitlab-examples/demo-group/mono-repo-deleted-27>>,
#<Project id:23 gitlab-examples/demo-group/yarn-project-deleted-23>>,
#<Project id:29 gitlab-examples/demo-group/mono-repo>>,
#<Project id:31 gitlab-examples/demo-group/yarn>>,
#<Project id:24 gitlab-examples/demo-group/npm-project-deleted-24>>,
#<Project id:25 gitlab-examples/demo-group/npm-deleted-25>>,
#<Project id:30 gitlab-examples/demo-group/npm>>,
#<Project id:26 gitlab-examples/demo-group/yarn-deleted-26>>,
#<Project id:20 gitlab-examples/security/sbom-example-deleted-20>>,
#<Project id:28 gitlab-examples/security/security-reports>>,
#<Project id:19 gitlab-examples/security/security-reports-deleted-19>>
]
Before
[33] pry(main)> ::Preloaders::UserMemberRolesInProjectsPreloader.new(projects: Project.where(namespace_id: Group.find(71).children), user: User.find(31)).execute
Group Load (1.1ms) SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids", "namespaces"."organization_id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 71 LIMIT 1 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/concerns/use_sql_function_for_primary_key_lookups.rb:8:in `find'*/
User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 31 LIMIT 1 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/concerns/use_sql_function_for_primary_key_lookups.rb:8:in `find'*/
Project Load (1.8ms) SELECT "projects"."id", "projects"."namespace_id" FROM "projects" WHERE "projects"."id" IN (SELECT "projects"."id" FROM "projects" WHERE "projects"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."parent_id" = 71 AND "namespaces"."type" = 'Group')) /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:24:in `execute'*/
Group Load (0.5ms) SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids", "namespaces"."organization_id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" IN (80, 72) /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/preloaders/user_member_roles_in_projects_preloader.rb:24:in `execute'*/
Namespace Load (0.9ms) SELECT namespaces.*, root_query.project_id as source_id FROM "namespaces" INNER JOIN (SELECT "projects"."id", "projects"."namespace_id", projects.id as project_id, namespaces.traversal_ids[1] as root_id FROM "projects" INNER JOIN "namespaces" ON "namespaces"."id" = "projects"."namespace_id" WHERE "projects"."id" IN (SELECT "projects"."id" FROM "projects" WHERE "projects"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."parent_id" = 71 AND "namespaces"."type" = 'Group'))) as root_query ON root_query.root_id = namespaces.id /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/preloaders/project_root_ancestor_preloader.rb:19:in `group_by'*/
Namespace Load (0.3ms) SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids", "namespaces"."organization_id" FROM "namespaces" WHERE "namespaces"."id" IN (80, 72) /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/preloaders/project_root_ancestor_preloader.rb:21:in `execute'*/
License Load (0.3ms) SELECT "licenses".* FROM "licenses" ORDER BY "licenses"."id" DESC LIMIT 100 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/license.rb:94:in `filter_map'*/
Plan Load (0.7ms) SELECT DISTINCT "plans".* FROM "plans" INNER JOIN "gitlab_subscriptions" ON "gitlab_subscriptions"."hosted_plan_id" = "plans"."id" WHERE "plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource') AND "gitlab_subscriptions"."namespace_id" = 71 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/ee/namespace.rb:228:in `map'*/
Plan Load (0.3ms) SELECT DISTINCT "plans".* FROM "plans" INNER JOIN "gitlab_subscriptions" ON "gitlab_subscriptions"."hosted_plan_id" = "plans"."id" WHERE "plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource') AND "gitlab_subscriptions"."namespace_id" = 71 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/ee/namespace.rb:228:in `map'*/
=> {24=>nil, 19=>nil, 25=>nil, 31=>nil, 29=>nil, 30=>nil, 26=>nil, 27=>nil, 23=>nil, 28=>nil, 20=>nil}
After
[37] pry(main)> ::Preloaders::UserMemberRolesInProjectsPreloader.new(projects: Project.where(namespace_id: Group.find(71).children), user: User.find(31)).execute
Group Load (0.9ms) SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids", "namespaces"."organization_id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 71 LIMIT 1 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/concerns/use_sql_function_for_primary_key_lookups.rb:8:in `find'*/
User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 31 LIMIT 1 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/concerns/use_sql_function_for_primary_key_lookups.rb:8:in `find'*/
Namespace Load (1.9ms) SELECT namespaces.*, root_query.project_id as source_id FROM "namespaces" INNER JOIN (SELECT "projects"."id", "projects"."namespace_id", projects.id as project_id, namespaces.traversal_ids[1] as root_id FROM "projects" INNER JOIN "namespaces" ON "namespaces"."id" = "projects"."namespace_id" WHERE "projects"."id" IN (SELECT "projects"."id" FROM "projects" WHERE "projects"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."parent_id" = 71 AND "namespaces"."type" = 'Group'))) as root_query ON root_query.root_id = namespaces.id /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/preloaders/project_root_ancestor_preloader.rb:19:in `group_by'*/
Project Load (0.6ms) SELECT "projects"."id", "projects"."namespace_id" FROM "projects" WHERE "projects"."id" IN (SELECT "projects"."id" FROM "projects" WHERE "projects"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."parent_id" = 71 AND "namespaces"."type" = 'Group')) /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/preloaders/project_root_ancestor_preloader.rb:21:in `execute'*/
Namespace Load (0.5ms) SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids", "namespaces"."organization_id" FROM "namespaces" WHERE "namespaces"."id" IN (80, 72) /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/app/models/preloaders/project_root_ancestor_preloader.rb:21:in `execute'*/
License Load (0.3ms) SELECT "licenses".* FROM "licenses" ORDER BY "licenses"."id" DESC LIMIT 100 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/license.rb:94:in `filter_map'*/
Plan Load (0.7ms) SELECT DISTINCT "plans".* FROM "plans" INNER JOIN "gitlab_subscriptions" ON "gitlab_subscriptions"."hosted_plan_id" = "plans"."id" WHERE "plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource') AND "gitlab_subscriptions"."namespace_id" = 71 /*application:console,db_config_name:main,console_hostname:xlg-precision,console_username:mokhax,line:/ee/app/models/ee/namespace.rb:228:in `map'*/
=> {24=>nil, 19=>nil, 25=>nil, 31=>nil, 29=>nil, 30=>nil, 26=>nil, 27=>nil, 23=>nil, 28=>nil, 20=>nil}
Edited by mo khan