Restore optimized MR metrics queries
What does this MR do and why?
This MR restores the optimizes MR metrics-based queries which are used on the merge request analytics page: https://gitlab.com/gitlab-org/gitlab/-/analytics/merge_request_analytics
The problem was the extra not
(mostly empty) filters which were not taken into account when determining whether to use the optimization or not.
How to set up and validate locally
- Go to Project > Analytics > Merge Request
- See the application logs and find DB queries only querying the
merge_request_metrics
table.
SELECT COUNT(*)
FROM "merge_request_metrics"
WHERE "merge_request_metrics"."target_project_id" = 1
AND "merge_request_metrics"."merged_at" >= '2022-02-20 23:00:00'
AND "merge_request_metrics"."merged_at" <= '2022-02-28 23:00:00'
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 #391787 (closed)
Edited by Adam Hegyi