Skip to content

Improve large MR count query: avoid primary sticking and add caching

Aakriti Gupta requested to merge ag-mr-count-query-improvement into master

What does this MR do?

Adds two improvements to a frequently run, poorly performing query for gathering the total count of MRs created in the last 90 days:

  1. Force use of the read-only replica, but clearing db load balancing session before running the query
  2. Cache the count for 24 hours

Related issue: #325580

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Aakriti Gupta

Merge request reports

Loading