Skip to content

Improve performance of Projects::PipelinesController#index

Yorick Peterse requested to merge pipelines-index-performance into master

What does this MR do?

This improves the performance of the controller Projects::PipelinesController#index in the following ways:

  1. The number of pipelines we count (per tab) is limited to 1000. If more than 1000 pipelines are present we display "1000+" instead of the exact number.
  2. Commit authors (retrieved when displaying pipelines) are pre-loaded. This removes the need for executing an additional SQL query for every pipeline just to get the commit author, reducing the total number of SQL queries by 20 in the worst case.
  3. The data necessary for determining if a pipeline has any warnings is preloaded. In the worst case this reduces the number of SQL queries by 20.
  4. Coverage data is no longer included in the serialised data when displaying pipelines, as this data is not used anyway. In the worst case this reduces the number of SQL queries by 20

Combined this can lead to a reduction of at least 60 SQL queries when displaying a project's pipelines.

Why was this MR needed?

This particular controller can execute many SQL queries and take a long time to load.

Screenshots (if relevant)

Using the limited count technique the tabs will now display counts like so:

Screenshot_from_2018-04-17_15-28-48

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/43132

Edited by Grzegorz Bizon

Merge request reports

Loading