Skip to content

Draft: Remove trigram indexes on issues.title/description for gitlab.com

Simon Tomlinson requested to merge remove-issues-trigram-index into master

What does this MR do and why?

Drop the trigram indexes on issues.description and issues.title, but only when run on gitlab.com.

These indexes contribute to very long autovaccuum times.

Relates to #331829

Migration output

(Run locally with Gitlab.com? changed to return true)

== 20211008160040 RemoveIssuesTrigramIndex: migrating =========================
-- transaction_open?()
   -> 0.0000s
-- indexes(:issues)
   -> 0.0102s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_description_trigram"})
   -> 0.0037s
-- execute("RESET statement_timeout")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- indexes(:issues)
   -> 0.0075s
-- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_title_trigram"})
   -> 0.0020s
== 20211008160040 RemoveIssuesTrigramIndex: migrated (0.0274s) ================

== 20211008160040 RemoveIssuesTrigramIndex: reverting =========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :title, {:name=>"index_issues_on_title_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
   -> 0.0087s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- add_index(:issues, :title, {:name=>"index_issues_on_title_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
   -> 0.0047s
-- execute("RESET statement_timeout")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :description, {:name=>"index_issues_on_description_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
   -> 0.0078s
-- add_index(:issues, :description, {:name=>"index_issues_on_description_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
   -> 0.0042s
== 20211008160040 RemoveIssuesTrigramIndex: reverted (0.0293s) ================

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Simon Tomlinson

Merge request reports

Loading