Skip to content

Drop an index from the deployments table concurrently

What does this MR do and why?

This change is part of an epic to optimise the deployments table: &10185

This will drop the partial_index_deployments_for_legacy_successful_deployments index concurrently. There is no previous MR to drop the index asynchronously in production.

Given that the index has a usage rate of 0 according to Thanos, and its size in production is 16kB, I think this should be okay to drop concurrently.

Index size in production

Screenshot_2023-10-27_at_13.44.33

Screenshots or screen recordings

DB Migration output

main: == [advisory_lock_connection] object_id: 179980, pg_backend_pid: 63243
main: == 20231027013210 RemovePartialIndexDeploymentsForLegacySuccessfulDeployments: migrating 
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.1004s
main: -- indexes(:deployments)
main:    -> 0.0072s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- remove_index(:deployments, {:algorithm=>:concurrently, :name=>"partial_index_deployments_for_legacy_successful_deployments"})
main:    -> 0.0034s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20231027013210 RemovePartialIndexDeploymentsForLegacySuccessfulDeployments: migrated (0.1341s) 

main: == [advisory_lock_connection] object_id: 179980, pg_backend_pid: 63243

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.

Edited by Pam Artiaga

Merge request reports

Loading