Skip to content

Retrieve merge request closing issues from database cache

Felipe Artur requested to merge issue_44821 into master

What does this MR do?

Retrieves issues that merge request will close from database instead of going trough the markdown.
When external issues tracker is enabled it ignores the cache because external issues are not cached.

Performance

I made some tests closing seven issues but i don't have enough proof that this will give significant performance boost. Query time goes from 0.14 to 0.03 but even so the scenario(my local environment) is not the ideal to test. We can check how it goes in prod.

Before

old

After

new

closes #44821 (closed)

Query generated each time a merge request is rendered(no sequencial scans)

SELECT "issues".*
FROM "issues"
INNER JOIN "merge_requests_closing_issues" ON "issues"."id" = "merge_requests_closing_issues"."issue_id"
WHERE "merge_requests_closing_issues"."merge_request_id" = 248;
Nested Loop  (cost=0.43..23.43 rows=7 width=333) (actual time=0.012..0.023 rows=6 loops=1)
 ->  Index Scan using index_merge_requests_closing_issues_on_merge_request_id on merge_requests_closing_issues  (cost=0.15..7.28 rows=7 width=4) (actual time=0.006..0.008 rows=6 loops=1)
       Index Cond: (merge_request_id = 248)
 ->  Index Scan using issues_pkey on issues  (cost=0.28..2.30 rows=1 width=333) (actual time=0.002..0.002 rows=1 loops=6)
       Index Cond: (id = merge_requests_closing_issues.issue_id)
Planning time: 0.165 ms
Execution time: 0.047 ms
Edited by Felipe Artur

Merge request reports