ci_builds.updated_at is used for filtering but is not indexed
For example, we have queries such as this:
SELECT "ci_builds".* FROM "ci_builds" INNER JOIN "projects" ON "projects"."id" = "ci_builds"."project_id" AND "projects"."pending_delete" = 'f' WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."status" = 'running' AND (ci_builds.updated_at < '2017-04-20 16:00:01.780025') ORDER BY "ci_builds"."id" ASC LIMIT 50
;
This uses ci_builds.updated_at
which is not indexed, leading to less than ideal performance.