Commit e43133f2 authored by Michael Kozono's avatar Michael Kozono Committed by Adam Hegyi

Add file store indexes

Especially because Geo is adding replication support for
these models. And by default, only locally stored files are
synced. Adding these indexes improves the performance of
the queries that determine what should be synced.
parent 2bbc4d78
---
title: 'Geo: Add file store indexes'
merge_request: 37265
author:
type: added
# frozen_string_literal: true
class AddIndexOnMergeRequestDiffsExternalDiffStore < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :merge_request_diffs, :external_diff_store
end
def down
remove_concurrent_index :merge_request_diffs, :external_diff_store
end
end
# frozen_string_literal: true
class AddIndexOnTerraformStatesFileStore < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :terraform_states, :file_store
end
def down
remove_concurrent_index :terraform_states, :file_store
end
end
# frozen_string_literal: true
class AddIndexOnVulnerabilityExportsFileStore < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :vulnerability_exports, :file_store
end
def down
remove_concurrent_index :vulnerability_exports, :file_store
end
end
......@@ -19717,6 +19717,8 @@ CREATE INDEX index_merge_request_diff_commits_on_sha ON public.merge_request_dif
CREATE UNIQUE INDEX index_merge_request_diff_files_on_mr_diff_id_and_order ON public.merge_request_diff_files USING btree (merge_request_diff_id, relative_order);
CREATE INDEX index_merge_request_diffs_on_external_diff_store ON public.merge_request_diffs USING btree (external_diff_store);
CREATE INDEX index_merge_request_diffs_on_merge_request_id_and_id ON public.merge_request_diffs USING btree (merge_request_id, id);
CREATE INDEX index_merge_request_diffs_on_merge_request_id_and_id_partial ON public.merge_request_diffs USING btree (merge_request_id, id) WHERE ((NOT stored_externally) OR (stored_externally IS NULL));
......@@ -20487,6 +20489,8 @@ CREATE INDEX index_term_agreements_on_term_id ON public.term_agreements USING bt
CREATE INDEX index_term_agreements_on_user_id ON public.term_agreements USING btree (user_id);
CREATE INDEX index_terraform_states_on_file_store ON public.terraform_states USING btree (file_store);
CREATE INDEX index_terraform_states_on_locked_by_user_id ON public.terraform_states USING btree (locked_by_user_id);
CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON public.terraform_states USING btree (project_id, name);
......@@ -20645,6 +20649,8 @@ CREATE INDEX index_vulnerabilities_on_updated_by_id ON public.vulnerabilities US
CREATE INDEX index_vulnerability_exports_on_author_id ON public.vulnerability_exports USING btree (author_id);
CREATE INDEX index_vulnerability_exports_on_file_store ON public.vulnerability_exports USING btree (file_store);
CREATE INDEX index_vulnerability_exports_on_group_id_not_null ON public.vulnerability_exports USING btree (group_id) WHERE (group_id IS NOT NULL);
CREATE INDEX index_vulnerability_exports_on_project_id_not_null ON public.vulnerability_exports USING btree (project_id) WHERE (project_id IS NOT NULL);
......@@ -23984,5 +23990,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200715202659
20200716044023
20200716120419
20200718040100
20200718040200
20200718040300
\.
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