Remove unused merge_request_metrics index

What does this MR do and why?

Removes the unused partial index index_mr_metrics_on_project_merged_at_not_deployed from the merge_request_metrics table.

Merge request !256809 (merged) changed the deploy-metrics UPDATE query to use the already-existing index_mr_metrics_on_target_project_id_merged_at_nulls_last, so this dedicated partial index is redundant.

The index was prepared asynchronously (prepare_async_index) and built on GitLab.com by the DBAs, but it was never recorded in db/structure.sql. The synchronous-create follow-up (#628640 (closed)) was closed because the index is no longer needed. The merge_request_metrics table is over its index limit, so removing this unused index keeps the count down.

The post-deployment migration:

  • unprepare_async_index_by_name cancels any still-queued async build (self-managed may not have built it yet).
  • remove_concurrent_index_by_name drops the index where it exists and is a safe no-op otherwise.
  • down is a no-op: the index only exists on GitLab.com and was never in structure.sql, so there is nothing to recreate on rollback.

db/structure.sql is unchanged because the index was never recorded there.

Related to #628635 (closed)

Edited by Stan Hu

Merge request reports

Loading
Loading