Skip to content

Use project namespace to retrieve project members

Alex Pooley requested to merge ap-reroute-project-members into master

What does this MR do and why?

On the project members page (e.g. https://gitlab.com/gitlab-org/gitlab/-/project_members), retrieve the project members through the project namespace relationship instead of the polymorphic source relationship. There is a good explanation of the overall context in the issue description.

SQL Query Plans

15846663 is the ID of the project namespace for the gitlab project.

9970 is the gitlab-org group

project.namespace_members
SELECT 
  "members".* 
FROM 
  "members" 
WHERE 
  "members"."type" = 'ProjectMember' 
  AND "members"."member_namespace_id" = 15846663 
  AND "members"."requested_at" IS NULL

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/14090/commands/49219


project.namespace_requesters
SELECT 
  "members".* 
FROM 
  "members" 
WHERE 
  "members"."type" = 'ProjectMember' 
  AND "members"."member_namespace_id" = 15846663 
  AND "members"."requested_at" IS NOT NULL

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/14090/commands/49220


group.namespace_members
SELECT 
  "members".* 
FROM 
  "members" 
WHERE 
  "members"."type" = 'GroupMember' 
  AND "members"."member_namespace_id" = 9970 
  AND "members"."requested_at" IS NULL 
  AND "members"."access_level" != 5

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/14090/commands/49221


group.namespace_requesters
SELECT 
  "members".* 
FROM 
  "members" 
WHERE 
  "members"."type" = 'GroupMember' 
  AND "members"."member_namespace_id" = 9970 
  AND "members"."requested_at" IS NOT NULL

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/14090/commands/49222

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Pooley

Merge request reports

Loading