Skip to content

Remove temporary container_repositories indexes

Background

As part of &5523 (closed), we added several indexes to container_repositories to support driving the migration. Now that the migration is complete, we can remove all these indexes.

Proposal

Remove the following indexes from container_repositories:

  • tmp_index_container_repos_on_non_migrated
  • tmp_index_container_repositories_on_id_migration_state
  • tmp_index_migrated_container_registries
  • idx_container_repos_on_import_started_at_when_importing
  • idx_container_repos_on_migration_state_migration_plan_created
  • idx_container_repos_on_pre_import_done_at_when_pre_import_done
  • idx_container_repos_on_pre_import_started_at_when_pre_importing
  • index_container_repositories_on_greatest_completed_at
  • index_container_repositories_on_migration_state_import_done_at

Ensure that none of these indexes are currently in use (they should not, but still...) with the following query (https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW):

SELECT idx_scan, idx_tup_read, idx_tup_fetch 
FROM pg_stat_all_indexes 
WHERE indexrelname = '<name>';

If any are still being used, identify the related source code and open a followup issue under &9998 to get it removed (or add a note to an existing one if applicable).

Edited by João Pereira