Skip to content

Fix Service ping failing metrics for ecosystem stage (3)

What does this MR do and why?

The following metrics are failing in GitLab.com for devopsecosystem due to performance problem, that makes query time out on database. Comment here

Screenshots or screen recordings

Without indexes: LINK

image

With new indexes: LINK

image

How to set up and validate locally

  1. Go to https://console.postgres.ai/gitlab/joe-instances/34 to check the performance
  2. Run the following query:
explain SELECT MIN("integrations"."id") FROM "integrations" WHERE "integrations"."active" = TRUE AND "integrations"."group_id" IS NOT NULL AND "integrations"."inherit_from_id" IS NOT NULL AND "integrations"."type_new" = 'Integrations::GitlabSlackApplication'
  1. Execute the reset command to revert the database to the initial state
  2. Execute the following commands:
exec CREATE INDEX index_integrations_on_type_new_id_when_active_and_has_group ON integrations USING btree (type_new, id) WHERE ((active = true) AND (group_id IS NOT NULL));
  1. Run again the query from the step 2.
  2. Compare the results

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #366401 (closed)

Edited by Bojan Marjanovic

Merge request reports

Loading