Commit 144c4269 authored by Mike Kozono's avatar Mike Kozono

Add index to improve performance

of the projects deployments API endpoint.
parent 5f62cd3e
---
title: Add index to improve project deployments endpoint performance
merge_request: 57554
author:
type: performance
# frozen_string_literal: true
class AddIndexForProjectDeploymentsWithEnvironmentIdAndUpdatedAt < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at'
def up
add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :deployments, INDEX_NAME
end
end
018381c15d859a777afb2b3402ca4425ce52ab35dcd4d1e930b3a9928b2a2019
\ No newline at end of file
......@@ -22462,6 +22462,8 @@ CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments US
CREATE INDEX index_deployments_on_id_where_cluster_id_present ON deployments USING btree (id) WHERE (cluster_id IS NOT NULL);
CREATE INDEX index_deployments_on_project_and_environment_and_updated_at ON deployments USING btree (project_id, environment_id, updated_at);
CREATE INDEX index_deployments_on_project_and_finished ON deployments USING btree (project_id, finished_at) WHERE (status = 2);
CREATE INDEX index_deployments_on_project_id_and_id ON deployments USING btree (project_id, id DESC);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment