Add index for id on scan finding approval_merge_request_rules
What does this MR do and why?
This MR adds missing index related to !97270 (merged) as we have noticed timeouts in logs: https://gitlab.slack.com/archives/C101F3796/p1666681406248429
Queries
explain SELECT "approval_merge_request_rules"."id" FROM "approval_merge_request_rules" WHERE "approval_merge_request_rules"."id" >= 1 AND "approval_merge_request_rules"."report_type" = 4 ORDER BY "approval_merge_request_rules"."id" ASC LIMIT 1000;
Before
Time: 14.441 s
- planning: 1.182 ms
- execution: 14.439 s
- I/O read: 13.963 s
- I/O write: 0.000 ms
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12825/commands/45013
After
Time: 2.463 ms
- planning: 1.622 ms
- execution: 0.841 ms
- I/O read: 0.147 ms
- I/O write: 0.000 ms
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12825/commands/45015
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.
Edited by Alan (Maciej) Paruszewski