Resolve "Index namespaces parent_id, id"
What does this MR do?
Add an index: create index idx_namespaces_and_top_level_groups on namespaces (id) where parent_id IS NULL
As recommend by !57318 (comment 542943415) in order to walk over namespaces
table.
== 20210406063442 CreateNamespacesIdParentIdPartialIndex: migrating ===========
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :id, {:where=>"parent_id IS NULL", :name=>"index_namespaces_id_parent_id_is_null", :algorithm=>:concurrently})
-> 0.0096s
-- execute("SET statement_timeout TO 0")
-> 0.0004s
-- add_index(:namespaces, :id, {:where=>"parent_id IS NULL", :name=>"index_namespaces_id_parent_id_is_null", :algorithm=>:concurrently})
-> 0.0049s
-- execute("RESET ALL")
-> 0.0005s
== 20210406063442 CreateNamespacesIdParentIdPartialIndex: migrated (0.0163s) ==
== 20210406063442 CreateNamespacesIdParentIdPartialIndex: reverting ===========
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :id, {:name=>"index_namespaces_id_parent_id_is_null", :algorithm=>:concurrently})
-> 0.0075s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- remove_index(:namespaces, {:name=>"index_namespaces_id_parent_id_is_null", :algorithm=>:concurrently, :column=>:id})
-> 0.0091s
-- execute("RESET ALL")
-> 0.0005s
== 20210406063442 CreateNamespacesIdParentIdPartialIndex: reverted (0.0187s) ==
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #326637 (closed)
Edited by Alex Pooley