Commit 095c25f4 authored by Yannis Roussos's avatar Yannis Roussos

Merge branch '326637-index-namespaces-id-and-parent_id' into 'master'

Resolve "Index namespaces parent_id, id"

See merge request gitlab-org/gitlab!58220
parents d9cb3acf 51c32f4d
---
title: Partial index optimization for namespaces id
merge_request: 58220
author:
type: performance
# frozen_string_literal: true
class CreateNamespacesIdParentIdPartialIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
NAME = 'index_namespaces_id_parent_id_is_null'
disable_ddl_transaction!
def up
add_concurrent_index :namespaces, :id, where: 'parent_id IS NULL', name: NAME
end
def down
remove_concurrent_index :namespaces, :id, name: NAME
end
end
d29f002f88440a10674b251791fa027cb0ae1c1b0c4fd776a2078e3c94160f17
\ No newline at end of file
......@@ -23164,6 +23164,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 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_custom_project_templates_group_id_and_type ON namespaces USING btree (custom_project_templates_group_id, type) WHERE (custom_project_templates_group_id IS NOT NULL);
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