Skip to content

Resolve "Index namespaces parent_id, id"

Alex Pooley requested to merge 326637-index-namespaces-id-and-parent_id into master

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

Availability and Testing

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

Merge request reports

Loading