Commit 75b7e982 authored by Marc Shaw's avatar Marc Shaw

Add index on project_id and sha to deployments table

Merge Request: gitlab.com/gitlab-org/gitlab/-/merge_requests/43836
parent aa725dc6
---
title: Add index for project_id and sha to deployments table
merge_request: 43836
author:
type: performance
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddIndexOnProjectIdAndShaToDeployments < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_deployments_on_project_id_sha'
disable_ddl_transaction!
def up
add_concurrent_index :deployments, [:project_id, :sha], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name(:deployments, INDEX_NAME)
end
end
45530bb3090d9e8df3a79f42a06b042e0c40f6e185078c6d79d7ec334175c7d5
\ No newline at end of file
......@@ -19985,6 +19985,8 @@ CREATE INDEX index_deployments_on_project_id_and_status_and_created_at ON deploy
CREATE INDEX index_deployments_on_project_id_and_updated_at_and_id ON deployments USING btree (project_id, updated_at DESC, id DESC);
CREATE INDEX index_deployments_on_project_id_sha ON deployments USING btree (project_id, sha);
CREATE INDEX index_deployments_on_user_id_and_status_and_created_at ON deployments USING btree (user_id, status, created_at);
CREATE INDEX index_description_versions_on_epic_id ON description_versions USING btree (epic_id) WHERE (epic_id IS NOT NULL);
......
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