Skip to content

Optimize environment serializer by preloading associated entities [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Shinya Maeda requested to merge optimize-environments-serializer into master

What does this MR do?

This MR resolves bunch of N+1 Problem on EnvironmentSerializer that seems never gotten a performance optimization effort. The associated entities will be preloaded before it's iterated on the serialization.

See #234055 (closed) for more information.

Please note that an optimization for environment.deployment_platform is out of scope, as it's likely more complicated and need different optimization approach than preloading.

Screenshots (strongly suggested)

Loading the environment index page on local GitLab instance:

2021-04-08_15-23

Before

cat /home/shinya/Downloads/environments_perf_bar_1617870491270.json | jq '.details.active_record.details[].sql' | sort | uniq -c | sort -nr | pbcopy

     10 "SELECT \"deployments\".* FROM \"deployments\" WHERE \"deployments\".\"environment_id\" = $1 AND \"deployments\".\"status\" = $2 ORDER BY deployments.id DESC LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      9 "SELECT \"routes\".* FROM \"routes\" WHERE \"routes\".\"source_id\" = $1 AND \"routes\".\"source_type\" = $2 LIMIT $3"
      6 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"id\" = $1 LIMIT $2"
      6 "SELECT \"ci_builds\".* FROM \"ci_builds\" WHERE \"ci_builds\".\"type\" = $1 AND \"ci_builds\".\"commit_id\" = $2 AND (\"ci_builds\".\"retried\" = $3 OR \"ci_builds\".\"retried\" IS NULL) AND \"ci_builds\".\"when\" = $4 AND \"ci_builds\".\"status\" IN ($5, $6, $7, $8, $9) /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      5 "SELECT \"projects\".* FROM \"projects\" WHERE \"projects\".\"id\" = $1 LIMIT $2"
      5 "SELECT \"alert_management_alerts\".* FROM \"alert_management_alerts\" WHERE \"alert_management_alerts\".\"environment_id\" = $1 AND (\"alert_management_alerts\".\"status\" IN (0,1)) ORDER BY \"alert_management_alerts\".\"severity\" ASC, \"alert_management_alerts\".\"started_at\" DESC LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      3 "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      3 "SELECT \"ci_builds_metadata\".* FROM \"ci_builds_metadata\" WHERE \"ci_builds_metadata\".\"build_id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      3 "SELECT \"ci_builds\".* FROM \"ci_builds\" WHERE \"ci_builds\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      2 "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = $1 LIMIT $2"
      2 "SELECT \"routes\".* FROM \"routes\" WHERE \"routes\".\"source_id\" = $1 AND \"routes\".\"source_type\" = $2 LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'review/hoge') OR\n  'review/hoge' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'review/hoge' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'production') OR\n  'production' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'production' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'prd') OR\n  'prd' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'prd' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'customer-potal') OR\n  'customer-potal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-potal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'customer-portal') OR\n  'customer-portal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-portal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"users\".* FROM ((SELECT \"users\".* FROM \"users\" WHERE (LOWER(\"users\".\"email\") IN (LOWER('admin@example.com'))) AND \"users\".\"confirmed_at\" IS NOT NULL)\nUNION\n(SELECT \"users\".* FROM \"users\" INNER JOIN \"emails\" ON \"emails\".\"user_id\" = \"users\".\"id\" WHERE \"emails\".\"email\" = 'admin@example.com' AND \"users\".\"confirmed_at\" IS NOT NULL AND \"emails\".\"confirmed_at\" IS NOT NULL)) users /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"type\" = $1 AND \"services\".\"project_id\" = $2 LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"template\" = $1 AND \"services\".\"type\" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36) /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"project_id\" = $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"instance\" = $1 AND \"services\".\"type\" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36) /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"protected_environments\".* FROM \"protected_environments\" WHERE \"protected_environments\".\"project_id\" = $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"protected_branch_push_access_levels\".* FROM \"protected_branch_push_access_levels\" WHERE \"protected_branch_push_access_levels\".\"protected_branch_id\" = $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"protected_branches\".* FROM \"protected_branches\" WHERE \"protected_branches\".\"project_id\" = $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"projects\".\"id\" AS t0_r0, \"projects\".\"name\" AS t0_r1, \"projects\".\"path\" AS t0_r2, \"projects\".\"description\" AS t0_r3, \"projects\".\"created_at\" AS t0_r4, \"projects\".\"updated_at\" AS t0_r5, \"projects\".\"creator_id\" AS t0_r6, \"projects\".\"namespace_id\" AS t0_r7, \"projects\".\"last_activity_at\" AS t0_r8, \"projects\".\"import_url\" AS t0_r9, \"projects\".\"visibility_level\" AS t0_r10, \"projects\".\"archived\" AS t0_r11, \"projects\".\"avatar\" AS t0_r12, \"projects\".\"merge_requests_template\" AS t0_r13, \"projects\".\"star_count\" AS t0_r14, \"projects\".\"merge_requests_rebase_enabled\" AS t0_r15, \"projects\".\"import_type\" AS t0_r16, \"projects\".\"import_source\" AS t0_r17, \"projects\".\"approvals_before_merge\" AS t0_r18, \"projects\".\"reset_approvals_on_push\" AS t0_r19, \"projects\".\"merge_requests_ff_only_enabled\" AS t0_r20, \"projects\".\"issues_template\" AS t0_r21, \"projects\".\"mirror\" AS t0_r22, \"projects\".\"mirror_last_update_at\" AS t0_r23, \"projects\".\"mirror_last_successful_update_at\" AS t0_r24, \"projects\".\"mirror_user_id\" AS t0_r25, \"projects\".\"shared_runners_enabled\" AS t0_r26, \"projects\".\"runners_token\" AS t0_r27, \"projects\".\"build_coverage_regex\" AS t0_r28, \"projects\".\"build_allow_git_fetch\" AS t0_r29, \"projects\".\"build_timeout\" AS t0_r30, \"projects\".\"mirror_trigger_builds\" AS t0_r31, \"projects\".\"pending_delete\" AS t0_r32, \"projects\".\"public_builds\" AS t0_r33, \"projects\".\"last_repository_check_failed\" AS t0_r34, \"projects\".\"last_repository_check_at\" AS t0_r35, \"projects\".\"container_registry_enabled\" AS t0_r36, \"projects\".\"only_allow_merge_if_pipeline_succeeds\" AS t0_r37, \"projects\".\"has_external_issue_tracker\" AS t0_r38, \"projects\".\"repository_storage\" AS t0_r39, \"projects\".\"repository_read_only\" AS t0_r40, \"projects\".\"request_access_enabled\" AS t0_r41, \"projects\".\"has_external_wiki\" AS t0_r42, \"projects\".\"ci_config_path\" AS t0_r43, \"projects\".\"lfs_enabled\" AS t0_r44, \"projects\".\"description_html\" AS t0_r45, \"projects\".\"only_allow_merge_if_all_discussions_are_resolved\" AS t0_r46, \"projects\".\"repository_size_limit\" AS t0_r47, \"projects\".\"printing_merge_request_link_enabled\" AS t0_r48, \"projects\".\"auto_cancel_pending_pipelines\" AS t0_r49, \"projects\".\"service_desk_enabled\" AS t0_r50, \"projects\".\"cached_markdown_version\" AS t0_r51, \"projects\".\"delete_error\" AS t0_r52, \"projects\".\"last_repository_updated_at\" AS t0_r53, \"projects\".\"disable_overriding_approvers_per_merge_request\" AS t0_r54, \"projects\".\"storage_version\" AS t0_r55, \"projects\".\"resolve_outdated_diff_discussions\" AS t0_r56, \"projects\".\"remote_mirror_available_overridden\" AS t0_r57, \"projects\".\"only_mirror_protected_branches\" AS t0_r58, \"projects\".\"pull_mirror_available_overridden\" AS t0_r59, \"projects\".\"jobs_cache_index\" AS t0_r60, \"projects\".\"external_authorization_classification_label\" AS t0_r61, \"projects\".\"mirror_overwrites_diverged_branches\" AS t0_r62, \"projects\".\"pages_https_only\" AS t0_r63, \"projects\".\"external_webhook_token\" AS t0_r64, \"projects\".\"packages_enabled\" AS t0_r65, \"projects\".\"merge_requests_author_approval\" AS t0_r66, \"projects\".\"pool_repository_id\" AS t0_r67, \"projects\".\"runners_token_encrypted\" AS t0_r68, \"projects\".\"bfg_object_map\" AS t0_r69, \"projects\".\"detected_repository_languages\" AS t0_r70, \"projects\".\"merge_requests_disable_committers_approval\" AS t0_r71, \"projects\".\"require_password_to_approve\" AS t0_r72, \"projects\".\"emails_disabled\" AS t0_r73, \"projects\".\"max_pages_size\" AS t0_r74, \"projects\".\"max_artifacts_size\" AS t0_r75, \"projects\".\"pull_mirror_branch_prefix\" AS t0_r76, \"projects\".\"remove_source_branch_after_merge\" AS t0_r77, \"projects\".\"marked_for_deletion_at\" AS t0_r78, \"projects\".\"marked_for_deletion_by_user_id\" AS t0_r79, \"projects\".\"autoclose_referenced_issues\" AS t0_r80, \"projects\".\"suggestion_commit_message\" AS t0_r81, \"routes\".\"id\" AS t1_r0, \"routes\".\"source_id\" AS t1_r1, \"routes\".\"source_type\" AS t1_r2, \"routes\".\"path\" AS t1_r3, \"routes\".\"created_at\" AS t1_r4, \"routes\".\"updated_at\" AS t1_r5, \"routes\".\"name\" AS t1_r6 FROM \"projects\" LEFT OUTER JOIN \"routes\" ON \"routes\".\"source_type\" = $1 AND \"routes\".\"source_id\" = \"projects\".\"id\" WHERE \"routes\".\"path\" = $2 LIMIT $3"
      1 "SELECT \"projects\".* FROM \"projects\" WHERE \"projects\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"project_features\".* FROM \"project_features\" WHERE \"project_features\".\"project_id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"type\" = $1 AND \"namespaces\".\"id\" = $2 AND \"namespaces\".\"type\" = $3 LIMIT $4 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"environments\".* FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) AND \"environments\".\"id\" IN ($2, $3, $4, $5, $6) /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"emails\".* FROM \"emails\" WHERE \"emails\".\"user_id\" = $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COUNT(*) AS count_all, \"environments\".\"state\" AS environments_state FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 GROUP BY \"environments\".\"state\" /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COUNT(*) AS count_all, COALESCE(environment_type, name) AS coalesce_environment_type_name FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) GROUP BY COALESCE(environment_type, name) /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COALESCE(environment_type, name) AS folder, COUNT(*) AS size, MAX(id) AS last_id FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) GROUP BY COALESCE(environment_type, name) ORDER BY folder ASC LIMIT $2 OFFSET $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'review/hoge') OR\n  'review/hoge' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'review/hoge' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'production') OR\n  'production' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'production' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'prd') OR\n  'prd' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'prd' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'customer-potal') OR\n  'customer-potal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-potal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'customer-portal') OR\n  'customer-portal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-portal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"services\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"protected_branch_push_access_levels\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"protected_branches\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"environments\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"deployments\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"clusters\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"ci_pipelines\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"ci_builds\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname\n  FROM (\n         SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx\n           FROM pg_index\n          WHERE indrelid = '\"ci_builds_metadata\"'::regclass\n            AND indisprimary\n       ) i\n  JOIN pg_attribute a\n    ON a.attrelid = i.indrelid\n   AND a.attnum = i.indkey[i.idx]\n ORDER BY i.idx"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"services\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"protected_environments\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"protected_branch_push_access_levels\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"protected_branches\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"emails\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"deployments\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"cluster_projects\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"cluster_groups\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"ci_pipelines\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"ci_builds\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n       c.collname, col_description(a.attrelid, a.attnum) AS comment\n  FROM pg_attribute a\n  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n  LEFT JOIN pg_type t ON a.atttypid = t.oid\n  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = '\"ci_builds_metadata\"'::regclass\n   AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum"
      1 "SELECT 1 AS one FROM ((SELECT \"clusters\".* FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"cluster_projects\".\"project_id\" = 35)\nUNION\n(SELECT \"clusters\".* FROM \"clusters\" INNER JOIN \"cluster_groups\" ON \"cluster_groups\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"namespaces\" ON \"namespaces\".\"id\" = \"cluster_groups\".\"group_id\" AND \"namespaces\".\"type\" = 'Group' WHERE \"cluster_groups\".\"group_id\" IN (WITH RECURSIVE \"base_and_ancestors\" AS ((SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"type\" = 'Group' AND \"namespaces\".\"id\" = 1)\nUNION\n(SELECT \"namespaces\".* FROM \"namespaces\", \"base_and_ancestors\" WHERE \"namespaces\".\"type\" = 'Group' AND \"namespaces\".\"id\" = \"base_and_ancestors\".\"parent_id\")) SELECT \"namespaces\".\"id\" FROM \"base_and_ancestors\" AS \"namespaces\"))\nUNION\n(SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = 1)) clusters LIMIT $1 /*application:web,correlation_id:01F2R9GTVQRNA44JD2EESBT2FJ,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
  • Total query count: 104
  • Total execution time: 160ms

After

      2 "SELECT \"routes\".* FROM \"routes\" WHERE \"routes\".\"source_type\" = $1 AND \"routes\".\"source_id\" = $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      2 "SELECT \"routes\".* FROM \"routes\" WHERE \"routes\".\"source_id\" = $1 AND \"routes\".\"source_type\" = $2 LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      2 "SELECT \"deployments\".* FROM \"deployments\" WHERE \"deployments\".\"status\" = $1 AND \"deployments\".\"environment_id\" IN ($2, $3, $4, $5, $6) ORDER BY deployments.id DESC /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      2 "SELECT \"ci_builds\".* FROM \"ci_builds\" WHERE \"ci_builds\".\"type\" = $1 AND (\"ci_builds\".\"retried\" = $2 OR \"ci_builds\".\"retried\" IS NULL) AND \"ci_builds\".\"when\" = $3 AND \"ci_builds\".\"status\" IN ($4, $5, $6, $7, $8) AND \"ci_builds\".\"commit_id\" IN ($9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'review/hoge') OR\n  'review/hoge' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'review/hoge' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'production') OR\n  'production' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'production' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'prd') OR\n  'prd' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'prd' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'customer-potal') OR\n  'customer-potal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-potal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "WITH RECURSIVE \"clusters_cte\" AS ((SELECT \"clusters\".*, NULL AS group_parent_id, 0 AS depth FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"cluster_projects\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"projects\" ON \"projects\".\"id\" = \"cluster_projects\".\"project_id\" WHERE \"clusters\".\"management_project_id\" = 35 AND \"clusters\".\"cluster_type\" = 3 AND \"projects\".\"namespace_id\" = 1)\nUNION\n(SELECT \"clusters\".*, \"projects\".\"namespace_id\" AS group_parent_id, 1 AS depth FROM \"projects\" LEFT OUTER JOIN \"cluster_projects\" ON \"cluster_projects\".\"project_id\" = \"projects\".\"id\" LEFT OUTER JOIN \"clusters\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"projects\".\"id\" = 35)\nUNION\n(SELECT \"clusters\".*, \"namespaces\".\"parent_id\" AS group_parent_id, (\"clusters_cte\".\"depth\" + 1) FROM \"clusters_cte\", \"namespaces\" LEFT OUTER JOIN cluster_groups ON cluster_groups.group_id = namespaces.id LEFT OUTER JOIN clusters ON cluster_groups.cluster_id = clusters.id WHERE \"namespaces\".\"id\" = \"clusters_cte\".\"group_parent_id\")) SELECT \"clusters\".* FROM \"clusters_cte\" \"clusters\" WHERE \"clusters\".\"id\" IS NOT NULL AND \"clusters\".\"enabled\" = $1 AND (environment_scope IN ('*', 'customer-portal') OR\n  'customer-portal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY (CASE clusters.management_project_id\n  WHEN 35 THEN 0\n  ELSE depth\nEND) ASC\n, CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-portal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = $1"
      1 "SELECT \"users\".* FROM ((SELECT \"users\".* FROM \"users\" WHERE (LOWER(\"users\".\"email\") IN (LOWER('admin@example.com'))) AND \"users\".\"confirmed_at\" IS NOT NULL)\nUNION\n(SELECT \"users\".* FROM \"users\" INNER JOIN \"emails\" ON \"emails\".\"user_id\" = \"users\".\"id\" WHERE \"emails\".\"email\" = 'admin@example.com' AND \"users\".\"confirmed_at\" IS NOT NULL AND \"emails\".\"confirmed_at\" IS NOT NULL)) users /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"type\" = $1 AND \"services\".\"project_id\" = $2 LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"template\" = $1 AND \"services\".\"type\" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"project_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"services\".* FROM \"services\" WHERE \"services\".\"instance\" = $1 AND \"services\".\"type\" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"routes\".* FROM \"routes\" WHERE \"routes\".\"source_type\" = $1 AND \"routes\".\"source_id\" = $2"
      1 "SELECT \"protected_environments\".* FROM \"protected_environments\" WHERE \"protected_environments\".\"project_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"protected_branch_push_access_levels\".* FROM \"protected_branch_push_access_levels\" WHERE \"protected_branch_push_access_levels\".\"protected_branch_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"protected_branches\".* FROM \"protected_branches\" WHERE \"protected_branches\".\"project_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"projects\".\"id\" AS t0_r0, \"projects\".\"name\" AS t0_r1, \"projects\".\"path\" AS t0_r2, \"projects\".\"description\" AS t0_r3, \"projects\".\"created_at\" AS t0_r4, \"projects\".\"updated_at\" AS t0_r5, \"projects\".\"creator_id\" AS t0_r6, \"projects\".\"namespace_id\" AS t0_r7, \"projects\".\"last_activity_at\" AS t0_r8, \"projects\".\"import_url\" AS t0_r9, \"projects\".\"visibility_level\" AS t0_r10, \"projects\".\"archived\" AS t0_r11, \"projects\".\"avatar\" AS t0_r12, \"projects\".\"merge_requests_template\" AS t0_r13, \"projects\".\"star_count\" AS t0_r14, \"projects\".\"merge_requests_rebase_enabled\" AS t0_r15, \"projects\".\"import_type\" AS t0_r16, \"projects\".\"import_source\" AS t0_r17, \"projects\".\"approvals_before_merge\" AS t0_r18, \"projects\".\"reset_approvals_on_push\" AS t0_r19, \"projects\".\"merge_requests_ff_only_enabled\" AS t0_r20, \"projects\".\"issues_template\" AS t0_r21, \"projects\".\"mirror\" AS t0_r22, \"projects\".\"mirror_last_update_at\" AS t0_r23, \"projects\".\"mirror_last_successful_update_at\" AS t0_r24, \"projects\".\"mirror_user_id\" AS t0_r25, \"projects\".\"shared_runners_enabled\" AS t0_r26, \"projects\".\"runners_token\" AS t0_r27, \"projects\".\"build_coverage_regex\" AS t0_r28, \"projects\".\"build_allow_git_fetch\" AS t0_r29, \"projects\".\"build_timeout\" AS t0_r30, \"projects\".\"mirror_trigger_builds\" AS t0_r31, \"projects\".\"pending_delete\" AS t0_r32, \"projects\".\"public_builds\" AS t0_r33, \"projects\".\"last_repository_check_failed\" AS t0_r34, \"projects\".\"last_repository_check_at\" AS t0_r35, \"projects\".\"container_registry_enabled\" AS t0_r36, \"projects\".\"only_allow_merge_if_pipeline_succeeds\" AS t0_r37, \"projects\".\"has_external_issue_tracker\" AS t0_r38, \"projects\".\"repository_storage\" AS t0_r39, \"projects\".\"repository_read_only\" AS t0_r40, \"projects\".\"request_access_enabled\" AS t0_r41, \"projects\".\"has_external_wiki\" AS t0_r42, \"projects\".\"ci_config_path\" AS t0_r43, \"projects\".\"lfs_enabled\" AS t0_r44, \"projects\".\"description_html\" AS t0_r45, \"projects\".\"only_allow_merge_if_all_discussions_are_resolved\" AS t0_r46, \"projects\".\"repository_size_limit\" AS t0_r47, \"projects\".\"printing_merge_request_link_enabled\" AS t0_r48, \"projects\".\"auto_cancel_pending_pipelines\" AS t0_r49, \"projects\".\"service_desk_enabled\" AS t0_r50, \"projects\".\"cached_markdown_version\" AS t0_r51, \"projects\".\"delete_error\" AS t0_r52, \"projects\".\"last_repository_updated_at\" AS t0_r53, \"projects\".\"disable_overriding_approvers_per_merge_request\" AS t0_r54, \"projects\".\"storage_version\" AS t0_r55, \"projects\".\"resolve_outdated_diff_discussions\" AS t0_r56, \"projects\".\"remote_mirror_available_overridden\" AS t0_r57, \"projects\".\"only_mirror_protected_branches\" AS t0_r58, \"projects\".\"pull_mirror_available_overridden\" AS t0_r59, \"projects\".\"jobs_cache_index\" AS t0_r60, \"projects\".\"external_authorization_classification_label\" AS t0_r61, \"projects\".\"mirror_overwrites_diverged_branches\" AS t0_r62, \"projects\".\"pages_https_only\" AS t0_r63, \"projects\".\"external_webhook_token\" AS t0_r64, \"projects\".\"packages_enabled\" AS t0_r65, \"projects\".\"merge_requests_author_approval\" AS t0_r66, \"projects\".\"pool_repository_id\" AS t0_r67, \"projects\".\"runners_token_encrypted\" AS t0_r68, \"projects\".\"bfg_object_map\" AS t0_r69, \"projects\".\"detected_repository_languages\" AS t0_r70, \"projects\".\"merge_requests_disable_committers_approval\" AS t0_r71, \"projects\".\"require_password_to_approve\" AS t0_r72, \"projects\".\"emails_disabled\" AS t0_r73, \"projects\".\"max_pages_size\" AS t0_r74, \"projects\".\"max_artifacts_size\" AS t0_r75, \"projects\".\"pull_mirror_branch_prefix\" AS t0_r76, \"projects\".\"remove_source_branch_after_merge\" AS t0_r77, \"projects\".\"marked_for_deletion_at\" AS t0_r78, \"projects\".\"marked_for_deletion_by_user_id\" AS t0_r79, \"projects\".\"autoclose_referenced_issues\" AS t0_r80, \"projects\".\"suggestion_commit_message\" AS t0_r81, \"routes\".\"id\" AS t1_r0, \"routes\".\"source_id\" AS t1_r1, \"routes\".\"source_type\" AS t1_r2, \"routes\".\"path\" AS t1_r3, \"routes\".\"created_at\" AS t1_r4, \"routes\".\"updated_at\" AS t1_r5, \"routes\".\"name\" AS t1_r6 FROM \"projects\" LEFT OUTER JOIN \"routes\" ON \"routes\".\"source_type\" = $1 AND \"routes\".\"source_id\" = \"projects\".\"id\" WHERE \"routes\".\"path\" = $2 LIMIT $3"
      1 "SELECT \"projects\".* FROM \"projects\" WHERE \"projects\".\"id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"projects\".* FROM \"projects\" WHERE \"projects\".\"id\" = $1"
      1 "SELECT \"project_features\".* FROM \"project_features\" WHERE \"project_features\".\"project_id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"project_features\".* FROM \"project_features\" WHERE \"project_features\".\"project_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"type\" = $1 AND \"namespaces\".\"id\" = $2 AND \"namespaces\".\"type\" = $3 LIMIT $4 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"id\" = $1 LIMIT $2 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"id\" = $1"
      1 "SELECT \"environments\".* FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) AND \"environments\".\"id\" IN ($2, $3, $4, $5, $6) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"emails\".* FROM \"emails\" WHERE \"emails\".\"user_id\" = $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COUNT(*) AS count_all, \"environments\".\"state\" AS environments_state FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 GROUP BY \"environments\".\"state\" /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COUNT(*) AS count_all, COALESCE(environment_type, name) AS coalesce_environment_type_name FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) GROUP BY COALESCE(environment_type, name) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT COALESCE(environment_type, name) AS folder, COUNT(*) AS size, MAX(id) AS last_id FROM \"environments\" WHERE \"environments\".\"project_id\" = $1 AND (\"environments\".\"state\" IN ('available')) GROUP BY COALESCE(environment_type, name) ORDER BY folder ASC LIMIT $2 OFFSET $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'review/hoge') OR\n  'review/hoge' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'review/hoge' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'production') OR\n  'production' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'production' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'prd') OR\n  'prd' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'prd' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'customer-potal') OR\n  'customer-potal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-potal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = $1 AND \"clusters\".\"enabled\" = $2 AND (environment_scope IN ('*', 'customer-portal') OR\n  'customer-portal' LIKE\n    REPLACE(REPLACE(REPLACE(environment_scope,\n                        '%', '\\%'),\n                '_', '\\_'),\n        '*', '%')\n\n) ORDER BY CASE environment_scope\n  WHEN '*' THEN 0\n  WHEN 'customer-portal' THEN 2\n  ELSE 1\nEND DESC\n LIMIT $3 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"id\" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"ci_builds_metadata\".* FROM \"ci_builds_metadata\" WHERE \"ci_builds_metadata\".\"build_id\" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"ci_builds\".* FROM \"ci_builds\" WHERE \"ci_builds\".\"id\" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT \"alert_management_alerts\".* FROM \"alert_management_alerts\" WHERE (\"alert_management_alerts\".\"status\" IN (0,1)) AND \"alert_management_alerts\".\"environment_id\" IN ($1, $2, $3, $4, $5) ORDER BY \"alert_management_alerts\".\"severity\" ASC, \"alert_management_alerts\".\"started_at\" DESC /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
      1 "SELECT 1 AS one FROM ((SELECT \"clusters\".* FROM \"clusters\" INNER JOIN \"cluster_projects\" ON \"clusters\".\"id\" = \"cluster_projects\".\"cluster_id\" WHERE \"cluster_projects\".\"project_id\" = 35)\nUNION\n(SELECT \"clusters\".* FROM \"clusters\" INNER JOIN \"cluster_groups\" ON \"cluster_groups\".\"cluster_id\" = \"clusters\".\"id\" INNER JOIN \"namespaces\" ON \"namespaces\".\"id\" = \"cluster_groups\".\"group_id\" AND \"namespaces\".\"type\" = 'Group' WHERE \"cluster_groups\".\"group_id\" IN (WITH RECURSIVE \"base_and_ancestors\" AS ((SELECT \"namespaces\".* FROM \"namespaces\" WHERE \"namespaces\".\"type\" = 'Group' AND \"namespaces\".\"id\" = 1)\nUNION\n(SELECT \"namespaces\".* FROM \"namespaces\", \"base_and_ancestors\" WHERE \"namespaces\".\"type\" = 'Group' AND \"namespaces\".\"id\" = \"base_and_ancestors\".\"parent_id\")) SELECT \"namespaces\".\"id\" FROM \"base_and_ancestors\" AS \"namespaces\"))\nUNION\n(SELECT \"clusters\".* FROM \"clusters\" WHERE \"clusters\".\"cluster_type\" = 1)) clusters LIMIT $1 /*application:web,correlation_id:01F2R8XX23MXHRSKG2AS2AZAD4,endpoint_id:Projects::EnvironmentsController#index,line:/devkitkat/services/rails/cache/ruby/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `exec_query'*/"
  • Total query count: 48
  • Total execution time: 45ms

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports