Improve performance of Projects::PipelinesController#index
What does this MR do?
This improves the performance of the controller
Projects::PipelinesController#index in the following ways:
- 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.
- 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.
- 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.
- 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:
Does this MR meet the acceptance criteria?
- Changelog entry added, if necessary
- Tests added for this feature/bug
- Has been reviewed by Frontend
- Has been reviewed by Backend
- Has been reviewed by Database
- Conform by the merge request performance guides
- Conform by the style guides
- Squashed related commits together
End-to-end tests pass (
package-and-qamanual pipeline job)