Skip to content

Sync Add index for member_namespace and related columns

What does this MR do and why?

With !107304 (merged) we added a multi column index on the members table using the async index creation method. This MR is a follow up as part of the async method to create a sync migration of the same index creation.

> rails db:migrate:down:main VERSION=20221216232659                                                                                                                                  1m  386542-sync-add-index-for-member_namespace-and-related-columns :: 1h :: ● :: ⬡
main: == 20221216232659 IndexMembersOnMemberNamespaceIdCompoundSync: reverting ======
main: -- transaction_open?()
main:    -> 0.0001s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.3247s
main: -- indexes(:members)
main:    -> 0.0261s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- remove_index(:members, {:algorithm=>:concurrently, :name=>"index_members_on_member_namespace_id_compound"})
main:    -> 0.0044s
main: -- execute("RESET statement_timeout")
main:    -> 0.0009s
main: == 20221216232659 IndexMembersOnMemberNamespaceIdCompoundSync: reverted (0.3867s)

> rails db:migrate:up:main VERSION=20221216232659                                                                                                                                   33s  386542-sync-add-index-for-member_namespace-and-related-columns :: 8h :: ● :: ⬡
main: == 20221216232659 IndexMembersOnMemberNamespaceIdCompoundSync: migrating ======
main: -- transaction_open?()
main:    -> 0.0001s
main: -- view_exists?(:postgres_partitions)
main:    -> 1.7758s
main: -- index_exists?(:members, [:member_namespace_id, :type, :requested_at, :id], {:name=>"index_members_on_member_namespace_id_compound", :algorithm=>:concurrently})
main:    -> 0.1672s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0015s
main: -- add_index(:members, [:member_namespace_id, :type, :requested_at, :id], {:name=>"index_members_on_member_namespace_id_compound", :algorithm=>:concurrently})
main:    -> 0.0356s
main: -- execute("RESET statement_timeout")
main:    -> 0.0156s
main: == 20221216232659 IndexMembersOnMemberNamespaceIdCompoundSync: migrated (2.1955s)

MR acceptance checklist

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

Closes #386542 (closed)

Edited by Alex Pooley

Merge request reports