Commit f97b60b3 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'add-missing-cluster-usage-data-index' into 'master'

Add clusters index to improve usage data queries

See merge request gitlab-org/gitlab!28626
parents e41272e8 f13cebce
---
title: Add clusters index to improve usage data queries
merge_request: 28626
author:
type: performance
# frozen_string_literal: true
class AddClusterTypeIndexToClusters < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
INDEX_NAME = 'index_clusters_on_enabled_cluster_type_id_and_created_at'
disable_ddl_transaction!
def up
add_concurrent_index :clusters, [:enabled, :cluster_type, :id, :created_at], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :clusters, INDEX_NAME
end
end
......@@ -9211,6 +9211,8 @@ CREATE INDEX index_clusters_kubernetes_namespaces_on_project_id ON public.cluste
CREATE INDEX index_clusters_on_enabled_and_provider_type_and_id ON public.clusters USING btree (enabled, provider_type, id);
CREATE INDEX index_clusters_on_enabled_cluster_type_id_and_created_at ON public.clusters USING btree (enabled, cluster_type, id, created_at);
CREATE INDEX index_clusters_on_management_project_id ON public.clusters USING btree (management_project_id) WHERE (management_project_id IS NOT NULL);
CREATE INDEX index_clusters_on_user_id ON public.clusters USING btree (user_id);
......@@ -13411,6 +13413,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200401091051
20200401095430
20200401211005
20200402001106
20200402123926
20200402124802
20200402135250
......
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