Partial index for namespaces.type
What does this MR do?
This removes null
values from the index on namespaces (type)
(with a partial condition WHERE type is NOT NULL
).
For the reasoning and more background, please refer to https://gitlab.com/gitlab-org/gitlab-ce/issues/66956#note_214747945.
Screenshots
abrandl-gl:gitlab/ (ab/partial-index-for-namespaces-type✗) $ spring rake db:migrate [14:04:35]
Running via Spring preloader in process 32334
== 20190910114843 ExcludeNullsFromIndexOnNamespacesType: migrating ============
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :type, {:where=>"type is not null", :name=>"index_namespaces_on_type_partial", :algorithm=>:concurrently})
-> 0.0064s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- add_index(:namespaces, :type, {:where=>"type is not null", :name=>"index_namespaces_on_type_partial", :algorithm=>:concurrently})
-> 0.0179s
-- execute("RESET ALL")
-> 0.0004s
-- transaction_open?()
-> 0.0000s
-- select_one("SELECT current_setting('server_version_num') AS v")
-> 0.0004s
-- indexes(:namespaces)
-> 0.0059s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- remove_index(:namespaces, {:algorithm=>:concurrently, :name=>"index_namespaces_on_type"})
-> 0.0020s
-- execute("RESET ALL")
-> 0.0002s
== 20190910114843 ExcludeNullsFromIndexOnNamespacesType: migrated (0.0344s) ===
abrandl-gl:gitlab/ (ab/partial-index-for-namespaces-type) $ spring rake db:migrate:down VERSION=20190910114843 [14:04:44]
Running via Spring preloader in process 32385
== 20190910114843 ExcludeNullsFromIndexOnNamespacesType: reverting ============
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :type, {:name=>"index_namespaces_on_type", :algorithm=>:concurrently})
-> 0.0084s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- add_index(:namespaces, :type, {:name=>"index_namespaces_on_type", :algorithm=>:concurrently})
-> 0.0149s
-- execute("RESET ALL")
-> 0.0004s
-- transaction_open?()
-> 0.0000s
-- select_one("SELECT current_setting('server_version_num') AS v")
-> 0.0004s
-- indexes(:namespaces)
-> 0.0053s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- remove_index(:namespaces, {:algorithm=>:concurrently, :name=>"index_namespaces_on_type_partial"})
-> 0.0018s
-- execute("RESET ALL")
-> 0.0002s
== 20190910114843 ExcludeNullsFromIndexOnNamespacesType: reverted (0.0324s) ===
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios.
Edited by Andreas Brandl