Skip to content

Index for namespaces by root namespace lookup

Adam Hegyi requested to merge 402737-add-index-for-namespace-batching into master

What does this MR do and why?

This MR adds the index after the async index creation ran during the weekend: !118032 (merged)

I verified on PG.ai that the index was successfully created:

    "index_on_namespaces_namespaces_by_top_level_namespace" btree ((traversal_ids[1]), type, id)

DB

Up:

main: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: migrating =========
main: -- transaction_open?()
main:    -> 0.0001s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0785s
main: -- index_exists?(:namespaces, "(traversal_ids[1]), type, id", {:name=>"index_on_namespaces_namespaces_by_top_level_namespace", :algorithm=>:concurrently})
main:    -> 0.0262s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0006s
main: -- add_index(:namespaces, "(traversal_ids[1]), type, id", {:name=>"index_on_namespaces_namespaces_by_top_level_namespace", :algorithm=>:concurrently})
main:    -> 0.0078s
main: -- execute("RESET statement_timeout")
main:    -> 0.0007s
main: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: migrated (0.1514s)

main: == [advisory_lock_connection] object_id: 274480, pg_backend_pid: 20372
ci: == [advisory_lock_connection] object_id: 274720, pg_backend_pid: 20374
ci: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: migrating =========
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0013s
ci: -- index_exists?(:namespaces, "(traversal_ids[1]), type, id", {:name=>"index_on_namespaces_namespaces_by_top_level_namespace", :algorithm=>:concurrently})
ci:    -> 0.0244s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0005s
ci: -- add_index(:namespaces, "(traversal_ids[1]), type, id", {:name=>"index_on_namespaces_namespaces_by_top_level_namespace", :algorithm=>:concurrently})
ci:    -> 0.0081s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0006s
ci: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: migrated (0.0591s)

Down:

main: == [advisory_lock_connection] object_id: 274260, pg_backend_pid: 21785
main: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: reverting =========
main: -- transaction_open?()
main:    -> 0.0001s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0534s
main: -- indexes(:namespaces)
main:    -> 0.0197s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0007s
main: -- remove_index(:namespaces, {:algorithm=>:concurrently, :name=>"index_on_namespaces_namespaces_by_top_level_namespace"})
main:    -> 0.0021s
main: -- execute("RESET statement_timeout")
main:    -> 0.0006s
main: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: reverted (0.0955s)

main: == [advisory_lock_connection] object_id: 274260, pg_backend_pid: 21785


ci: == [advisory_lock_connection] object_id: 274240, pg_backend_pid: 21094
ci: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: reverting =========
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.3264s
ci: -- indexes(:namespaces)
ci:    -> 0.0193s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0004s
ci: -- remove_index(:namespaces, {:algorithm=>:concurrently, :name=>"index_on_namespaces_namespaces_by_top_level_namespace"})
ci:    -> 0.0028s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0006s
ci: == 20230420120431 CreateNamespacesByTopLevelNamespaceIndex: reverted (0.4481s)

ci: == [advisory_lock_connection] object_id: 274240, pg_backend_pid: 21094

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #402737 (closed)

Edited by Adam Hegyi

Merge request reports