Add index to chat names table on team_id and chat_id
What does this MR do and why?
This MR adds an index on chat_names
table on team_id
and chat_id
.
It stemmed from a discussion at !103478 (comment 1173507962)
Migrations
UP
main: == 20221116113323 AddIndexOnTeamIdAndChatId: migrating ========================
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0079s
main: -- index_exists?(:chat_names, [:team_id, :chat_id], {:name=>"index_chat_names_on_team_id_and_chat_id", :algorithm=>:concurrently})
main: -> 0.0022s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0001s
main: -- add_index(:chat_names, [:team_id, :chat_id], {:name=>"index_chat_names_on_team_id_and_chat_id", :algorithm=>:concurrently})
main: -> 0.2584s
main: -- execute("RESET statement_timeout")
main: -> 0.0005s
main: == 20221116113323 AddIndexOnTeamIdAndChatId: migrated (0.2818s) ===============
Down
main: == 20221116113323 AddIndexOnTeamIdAndChatId: reverting ========================
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0018s
main: -- indexes(:chat_names)
main: -> 0.0022s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0001s
main: -- remove_index(:chat_names, {:algorithm=>:concurrently, :name=>"index_chat_names_on_team_id_and_chat_id"})
main: -> 0.0018s
main: -- execute("RESET statement_timeout")
main: -> 0.0001s
main: == 20221116113323 AddIndexOnTeamIdAndChatId: reverted (0.0126s) ===============
How to set up and validate locally
- Migration should run without any issues.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #344856 (closed)
Edited by Rajendra Kadam