Index on deployments table for DeploymentsFinder query
Create index
exec CREATE INDEX index_deployments_on_project_id_and_environment_id_and_status_and_finished_at ON deployments USING btree (project_id, environment_id, status, finished_at);
to support query
SELECT "deployments"."deployable_id" FROM "deployments" WHERE "deployments"."project_id" = 7764 AND (deployments.environment_id = (SELECT "environments"."id" FROM "environments" WHERE "environments"."project_id" = 7764 AND "environments"."name" = 'production' LIMIT 1)) AND "deployments"."status" = 2 AND "deployments"."deployable_id" IS NOT NULL ORDER BY "deployments"."finished_at" DESC LIMIT 1000
This index is needed by the DeploymentsFinder's by_pipeline
filter method as noted in !83024 (comment 898758391)
Edited by Bala Kumar