Skip to content

Remove an index on the deployments table asynchronously

What does this MR do and why?

This is part of an epic to optimize the deployments table by removing unused indexes: &10185

This MR is an asynchronous removal migration for index_successful_deployments_on_cluster_id_and_environment_id. This index has a usage rate of 0.

The definition of this index is:

CREATE INDEX index_successful_deployments_on_cluster_id_and_environment_id ON deployments USING btree (cluster_id, environment_id) WHERE (status = 2);

The sync index removal will be done in a follow-up MR.

Screenshots or screen recordings

Migration output

main: == [advisory_lock_connection] object_id: 826200, pg_backend_pid: 46342
main: == 20230818034041 PrepareRemovalIndexSuccessDeploymentsOnClusterIdAndEnvironmentId: migrating 
main: -- index_exists?(:deployments, [:cluster_id, :environment_id], {:name=>"index_successful_deployments_on_cluster_id_and_environment_id"})
main:    -> 0.0078s
main: -- quote_column_name("index_successful_deployments_on_cluster_id_and_environment_id")
main:    -> 0.0000s
main: == 20230818034041 PrepareRemovalIndexSuccessDeploymentsOnClusterIdAndEnvironmentId: migrated (0.0135s) 

main: == [advisory_lock_connection] object_id: 826200, pg_backend_pid: 46342

How to set up and validate locally

N/A

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #402514 (closed)

Edited by Pam Artiaga

Merge request reports