Remove trigram index on notes
What does this MR do and why?
This removes the GIN index on notes because these are expensive to update. This causes note creation to sometimes time out. And causes autovacuum to take a long time.
This query is also seldom used. We only search for notes in the Global Search page and only searches within projects are allowed. And when searching within a project, this global index is unlikey to be used and might even degrade performance as we see in issue searches.
For issue searches within a project, we use a CTE to avoid the global trigram index.
Migration output
== 20211008043855 RemoveNotesTrigramIndex: migrating ==========================
-- transaction_open?()
-> 0.0000s
-- indexes(:notes)
-> 0.0073s
-- current_schema()
-> 0.0003s
== 20211008043855 RemoveNotesTrigramIndex: migrated (0.0112s) =================
== 20211008043855 RemoveNotesTrigramIndex: reverting ==========================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:notes, :note, {:name=>"index_notes_on_note_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
-> 0.0062s
-- add_index(:notes, :note, {:name=>"index_notes_on_note_trigram", :using=>:gin, :opclass=>{:content=>:gin_trgm_ops}, :algorithm=>:concurrently})
-> 0.0317s
== 20211008043855 RemoveNotesTrigramIndex: reverted (0.0456s) =================
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #331829
Edited by Heinrich Lee Yu