Commit 88fe0bcb authored by Arturo Herrero's avatar Arturo Herrero

Remove unnecessary index on services for usage data

- index_services_on_type_id_when_active_not_instance_not_template was
  added https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27093 and
  updated https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38147
  just for the usage data.
- There is no other query for template = FALSE in the codebase.
- We will maintain the partial index for (type, id).
parent edd74d2a
---
title: Remove unnecessary index on services for usage data
merge_request: 45655
author:
type: other
# frozen_string_literal: true
class RemoveIndexServiceForUsageData < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_services_on_type_id_when_active_not_instance_not_template'
disable_ddl_transaction!
def up
remove_concurrent_index_by_name :services, INDEX_NAME
end
def down
add_concurrent_index :services, [:type, :id], where: 'active = TRUE AND instance = FALSE AND template = FALSE', name: INDEX_NAME
end
end
ba16ad5a51494f436dc47ffb924f94ce7795bfd3b9061ca58d1c8dda238245e9
\ No newline at end of file
......@@ -21536,8 +21536,6 @@ CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON services USIN
CREATE INDEX index_services_on_type_id_when_active_and_project_id_not_null ON services USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL));
CREATE INDEX index_services_on_type_id_when_active_not_instance_not_template ON services USING btree (type, id) WHERE ((active = true) AND (instance = false) AND (template = false));
CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING btree (group_id, type);
CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);
......
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