Follow-up from "Add concurrent index on merged_at for PA Data migration"
The following discussion from !17054 (merged) should be addressed:
-
@abrandl started a discussion: (+4 comments) @pshutsin This isn't going to fix #32206 (closed) fully as this migration is going to run after the migration from !15137 (merged). Note some installs don't differentiate between normal/post-deploy migrations.
I'd suggest to also change !15137 (merged) to create an index in the post-deploy. This is assuming the migration hasn't been released or deployed yet and we still have time to adjust it.
Do we need the specialized index
(merged_at, id)
in other cases too or is(merged_at)
enough?
Suggestion
Since (merged_at, id) is used for data migration only and UI can use smaller (merged_at) index we should replace former with latter after data migration is finished.
add_concurrent_index :merge_request_metrics, :merged_at
remove_concurrent_index :merge_request_metrics, [:merged_at, :id]