Add index on deployable_type/id for deployments
What does this MR do?
This index helps when we view job page, for job that performs deployment. We look for deployment made by our build.
It is visible here: https://gitlab.com/gitlab-com/www-gitlab-com/-/jobs/77501980.
This is the query in question that gets optimised by index: SELECT "deployments".* FROM "deployments" WHERE "deployments"."deployable_id" = 77501980 AND "deployments"."deployable_type" = 'CommitStatus' ORDER BY deployments.id DESC LIMIT 1
. It uses STI and we don't have index on deployable_type
and deployable_id
.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - Conform by the code review guidelines
-
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides
What are the relevant issue numbers?
Edited by Yorick Peterse