Query the sum of approvals required instead of calculating it in Rails
What does this MR do and why?
-
Query the sum of approvals required instead of calculating it in Rails. This skips fetching all the approval rules in memory.
-
Existing query - https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/22463/commands/72393
SELECT
"approval_project_rules".*
FROM
"approval_project_rules"
WHERE
"approval_project_rules"."project_id" = 278964
- New query - https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/22463/commands/72392
SELECT
SUM(approvals_required)
FROM
"approval_project_rules"
WHERE
"approval_project_rules"."project_id" = 278964
LIMIT 1
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
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 #413231 (closed)