Skip to content

Prepare indexes for ci_pipelines loose FKs

Create the following indexes:

  • index for table merge_requests: "index_merge_requests_on_head_pipeline_id_bigint" btree (head_pipeline_id_convert_to_bigint)
  • index for table merge_request_metrics: "index_merge_request_metrics_on_pipeline_id_bigint" btree (pipeline_id_convert_to_bigint)
  • index for table packages_build_infos: "index_packages_build_infos_on_pipeline_id_bigint" btree (pipeline_id_convert_to_bigint)
  • index for table packages_build_infos: "index_packages_build_infos_package_id_pipeline_id_bigint_id" btree (package_id, pipeline_id_convert_to_bigint, id)
  • index for table merge_trains: "index_merge_trains_on_pipeline_id_bigint" btree (pipeline_id_convert_to_bigint)
  • index for table vulnerability_feedback: "index_vulnerability_feedback_on_pipeline_id_bigint" btree (pipeline_id_convert_to_bigint)
  • index for table vulnerability_occurrence_pipelines: "index_vulnerability_occurrence_pipelines_on_pipeline_id" btree (pipeline_id_convert_to_bigint)
  • index for table vulnerability_occurrence_pipelines: "vulnerability_occurrence_pipelines_on_unique_keys" UNIQUE, btree (occurrence_id, pipeline_id_convert_to_bigint)

See this swap step at here for:

  • adding ensure_batched_background_migration_is_finished migration to finalize the backfill in the first minor version after the required stop (see Adding required stops and check with release manager for the next required stop)
  • choose async/concurrent index creation depending on how long the index creation takes

Example MRs:

Edited by Tianwen Chen