Commit e2b863f0 authored by Toon Claes's avatar Toon Claes

Merge branch '208886-optimize-deployment-counters-related-to-the-deployment' into 'master'

Optimize deployment counters related to the  ::Deployment

Closes #208886

See merge request gitlab-org/gitlab!26757
parents 7a5fe638 52e224e7
---
title: Optimize Deployment related counters
merge_request: 26757
author:
type: performance
# frozen_string_literal: true
class AddIndexOnUserIdStatusCreatedAtToDeployments < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :deployments, [:user_id, :status, :created_at]
end
def down
remove_concurrent_index :deployments, [:user_id, :status, :created_at]
end
end
# frozen_string_literal: true
class AddIndexOnIdAndStatusToDeployments < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :deployments, [:id, :status]
end
def down
remove_concurrent_index :deployments, [:id, :status]
end
end
......@@ -1409,6 +1409,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t.index ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id"
t.index ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id"
t.index ["environment_id", "status"], name: "index_deployments_on_environment_id_and_status"
t.index ["id", "status"], name: "index_deployments_on_id_and_status"
t.index ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))"
t.index ["project_id", "id"], name: "index_deployments_on_project_id_and_id", order: { id: :desc }
t.index ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true
......@@ -1417,6 +1418,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status"
t.index ["project_id", "updated_at", "id"], name: "index_deployments_on_project_id_and_updated_at_and_id", order: { updated_at: :desc, id: :desc }
t.index ["project_id"], name: "partial_index_deployments_for_project_id_and_tag", where: "(tag IS TRUE)"
t.index ["user_id", "status", "created_at"], name: "index_deployments_on_user_id_and_status_and_created_at"
end
create_table "description_versions", force: :cascade do |t|
......
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