Investigate performance problems for CancelRedundantPipelinesService

In gitlab-com/gl-infra/production#14758 (closed) this service put a lot of pressure on the database to find cancelables pipelines for a specific project. We have added a temporary performance fix !122764 (merged) and a feature flag to disable the service for problematic projects !123032 (merged), but we should investigate what changed in the project/usage that made the service to misbehave.

The query used by the service read 1.4GB of data:

Shared buffers:
  - hits: 179809 (~1.40 GiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0
Edited by Marius Bobin