Skip to content

Drop unused index on ci_builds

Max Orefice requested to merge morefice/drop-unused-ci-builds-index-4 into master

Ref: #271620 (closed)

What does this MR do and why?

Following up !91473 (merged).

This MR drops index_ci_builds_on_queued_at which is no longer being used according to Thanos.

This will be executed as a no-op migration on gitlab.com as we dropped this index with a CR in gitlab-com/gl-infra/production#7435 (closed).

Screenshots or screen recordings

Screenshot_2022-06-30_at_11.16.51

Database

List of relations  
 Schema |             Name             | Type  |  Owner  |   Table   | Size  | Description   
--------+------------------------------+-------+---------+-----------+-------+-------------  
 public | index_ci_builds_on_queued_at | index | joe_292 | ci_builds | 67 GB |   
(1 row)  

Migrations up

  gitlab git:(master)  rails db:migrate:ci
ci: == 20220719081542 DropQueuedAtIndexFromCiBuilds: migrating ====================
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- indexes(:ci_builds)
ci:    -> 0.0089s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- remove_index(:ci_builds, {:algorithm=>:concurrently, :name=>"index_ci_builds_on_queued_at"})
ci:    -> 0.0020s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20220719081542 DropQueuedAtIndexFromCiBuilds: migrated (0.0152s) ===========

  gitlab git:(master)  rails db:migrate:main
main: == 20220719081542 DropQueuedAtIndexFromCiBuilds: migrating ====================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:ci_builds)
main:    -> 0.0087s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- remove_index(:ci_builds, {:algorithm=>:concurrently, :name=>"index_ci_builds_on_queued_at"})
main:    -> 0.0012s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20220719081542 DropQueuedAtIndexFromCiBuilds: migrated (0.0142s) ===========

Migrations down

  gitlab git:(master)  rails db:rollback:ci
ci: == 20220719081542 DropQueuedAtIndexFromCiBuilds: reverting ====================
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- index_exists?(:ci_builds, :queued_at, {:name=>"index_ci_builds_on_queued_at", :algorithm=>:concurrently})
ci:    -> 0.0082s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- add_index(:ci_builds, :queued_at, {:name=>"index_ci_builds_on_queued_at", :algorithm=>:concurrently})
ci:    -> 0.0019s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20220719081542 DropQueuedAtIndexFromCiBuilds: reverted (0.0148s) ===========

  gitlab git:(master)  rails db:rollback:main
main: == 20220719081542 DropQueuedAtIndexFromCiBuilds: reverting ====================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:ci_builds, :queued_at, {:name=>"index_ci_builds_on_queued_at", :algorithm=>:concurrently})
main:    -> 0.0076s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:ci_builds, :queued_at, {:name=>"index_ci_builds_on_queued_at", :algorithm=>:concurrently})
main:    -> 0.0017s
main: -- execute("RESET statement_timeout")
main:    -> 0.0001s
main: == 20220719081542 DropQueuedAtIndexFromCiBuilds: reverted (0.0132s) ===========

Impact

Reduced ci_builds size by 70GB

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 Marius Bobin

Merge request reports

Loading