Commit 22d64a74 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '330086-inverse-index-on-namespaces-parent_id-id' into 'master'

Resolve "Inverse index on namespaces parent_id, id"

See merge request gitlab-org/gitlab!61098
parents 933bc278 2b6d448f
---
title: Partial index optimization for namespaces id
merge_request: 61098
author:
type: performance
# frozen_string_literal: true
class CreateNamespacesIdParentIdInversePartialIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
NAME = 'index_namespaces_id_parent_id_is_not_null'
disable_ddl_transaction!
def up
add_concurrent_index :namespaces, :id, where: 'parent_id IS NOT NULL', name: NAME
end
def down
remove_concurrent_index :namespaces, :id, name: NAME
end
end
f400225e6caa854f825422b9799e61ea557ab4bd3e4a33dc3cd3193ed3ce1db2
\ No newline at end of file
...@@ -23454,6 +23454,8 @@ CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON n ...@@ -23454,6 +23454,8 @@ CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON n
CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id); CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id);
CREATE INDEX index_namespaces_id_parent_id_is_not_null ON namespaces USING btree (id) WHERE (parent_id IS NOT NULL);
CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL); CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL);
CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at); CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at);
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