Skip to content

N+1 SQL queries in MergeRequestsController#ci_environment_status

On GitLab.com, there are significant number of slow endpoints coming from MergeRequestsController#ci_environment_status: https://log.gitlab.net/goto/52d53c5de5dd9d3300e434234c620553

image

The performance bar shows close to 1000 SQL queries retrieving clusters:

image

SQL backtraces:

image

image

Followup:

Edited by Thong Kuah