Skip to content

Geo: Remove unused indexes

Michael Kozono requested to merge mk/remove-unused-indexes into master

What does this MR do?

These indexes were originally added because it was assumed that verification backfill queries would be the same for the new Geo Self-Service Framework as they were for legacy project/wiki verification. But we have added a state machine and are using a different approach for the framework, so the queries are different, and will not use these indexes.

Resolves #281064 (closed)

DB migrations

Migrate:

➜  gitlab git:(mk/remove-unused-indexes) ✗ bin/rake db:migrate        
== 20201124185639 RemoveUnusedIndexes: migrating ==============================
-- transaction_open?()
   -> 0.0000s
-- indexes(:packages_package_files)
   -> 0.0032s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- remove_index(:packages_package_files, {:algorithm=>:concurrently, :name=>"packages_packages_verification_failure_partial"})
   -> 0.0087s
-- execute("RESET ALL")
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- indexes(:packages_package_files)
   -> 0.0022s
-- remove_index(:packages_package_files, {:algorithm=>:concurrently, :name=>"packages_packages_verification_checksum_partial"})
   -> 0.0027s
-- transaction_open?()
   -> 0.0000s
-- indexes(:snippet_repositories)
   -> 0.0019s
-- remove_index(:snippet_repositories, {:algorithm=>:concurrently, :name=>"snippet_repositories_verification_failure_partial"})
   -> 0.0013s
-- transaction_open?()
   -> 0.0000s
-- indexes(:snippet_repositories)
   -> 0.0014s
-- remove_index(:snippet_repositories, {:algorithm=>:concurrently, :name=>"snippet_repositories_verification_checksum_partial"})
   -> 0.0015s
-- transaction_open?()
   -> 0.0000s
-- indexes(:terraform_state_versions)
   -> 0.0018s
-- remove_index(:terraform_state_versions, {:algorithm=>:concurrently, :name=>"terraform_state_versions_verification_failure_partial"})
   -> 0.0014s
-- transaction_open?()
   -> 0.0000s
-- indexes(:terraform_state_versions)
   -> 0.0015s
-- remove_index(:terraform_state_versions, {:algorithm=>:concurrently, :name=>"terraform_state_versions_verification_checksum_partial"})
   -> 0.0012s
== 20201124185639 RemoveUnusedIndexes: migrated (0.0309s) =====================

Rollback:

➜  gitlab git:(mk/remove-unused-indexes) ✗ bin/rake db:rollback    
== 20201124185639 RemoveUnusedIndexes: reverting ==============================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:packages_package_files, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"packages_packages_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0027s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- add_index(:packages_package_files, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"packages_packages_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0053s
-- execute("RESET ALL")
   -> 0.0001s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:packages_package_files, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"packages_packages_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0022s
-- add_index(:packages_package_files, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"packages_packages_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0018s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:snippet_repositories, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"snippet_repositories_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0017s
-- add_index(:snippet_repositories, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"snippet_repositories_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0024s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:snippet_repositories, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"snippet_repositories_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0011s
-- add_index(:snippet_repositories, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"snippet_repositories_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0013s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:terraform_state_versions, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"terraform_state_versions_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0015s
-- add_index(:terraform_state_versions, :verification_failure, {:where=>"(verification_failure IS NOT NULL)", :name=>"terraform_state_versions_verification_failure_partial", :algorithm=>:concurrently})
   -> 0.0028s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:terraform_state_versions, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"terraform_state_versions_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0018s
-- add_index(:terraform_state_versions, :verification_checksum, {:where=>"(verification_checksum IS NOT NULL)", :name=>"terraform_state_versions_verification_checksum_partial", :algorithm=>:concurrently})
   -> 0.0016s
== 20201124185639 RemoveUnusedIndexes: reverted (0.0283s) =====================

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Michael Kozono

Merge request reports

Loading