Skip to content

Add database index on emails to detumbled_email column

Ian Anderson requested to merge ia-add_index_on_emails_to_detumbled_email into master

What does this MR do and why?

Add database index on emails to detumbled_email column. This was missed in the original migration that added the column.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Up Migration
▶ bundle exec rake db:migrate
main: == [advisory_lock_connection] object_id: 128220, pg_backend_pid: 558876
main: == 20240809201229 AddIndexOnEmailsToDetumbledEmail: migrating =================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0033s
main: -- index_exists?(:emails, :detumbled_email, {:name=>"index_emails_on_detumbled_email", :algorithm=>:concurrently})
main:    -> 0.0038s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- add_index(:emails, :detumbled_email, {:name=>"index_emails_on_detumbled_email", :algorithm=>:concurrently})
main:    -> 0.0015s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20240809201229 AddIndexOnEmailsToDetumbledEmail: migrated (0.0206s) ========

main: == [advisory_lock_connection] object_id: 128220, pg_backend_pid: 558876
Down Migration
▶ bundle exec rake db:migrate:down:main VERSION=20240809201229
main: == [advisory_lock_connection] object_id: 127900, pg_backend_pid: 558021
main: == 20240809201229 AddIndexOnEmailsToDetumbledEmail: reverting =================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0027s
main: -- indexes(:emails)
main:    -> 0.0064s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- remove_index(:emails, {:algorithm=>:concurrently, :name=>"index_emails_on_detumbled_email"})
main:    -> 0.0012s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240809201229 AddIndexOnEmailsToDetumbledEmail: reverted (0.0250s) ========

main: == [advisory_lock_connection] object_id: 127900, pg_backend_pid: 558021

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Merge request reports

Loading