Optimise member_roles.elevating related queries
What does this MR do and why?
In !114734 (merged) we merged adding read_vulnerability
permission to Custom roles. This, however, caused a performance problem. Afterward, we also added admin_vulnerability
permission.
We need to improve the performance of elevating
scope. Right now the query is behind a feature flag elevated_guests
.
Database
I specifically tested the query called from billed_group_users
for group gitlab-org
as this one is used on the page we saw the problem on (group members page on gitlab.com).
- Old query: https://console.postgres.ai/shared/5beae453-e31f-4e78-8566-06e7a5ad2ea0
- New query: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/19924/commands/65068
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #411385 (closed)
Edited by Jessie Young