Skip to content

Commit 31ea1c9

Browse files
committed
Switch name indexes from GIST -> GIN to improve defn search speed.
1 parent 5308b66 commit 31ea1c9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sql/2026-01-12_use-gin-trigram.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- Switch from GIST trigram to GIN trigram for both scoped and global definition search tables.
2+
-- GIN is slower to build, but faster to search, and we compute the indexes in background jobs anyways.
3+
4+
CREATE INDEX scoped_definition_search_docs_name_trigram_gin ON scoped_definition_search_docs USING GIN (name gin_trgm_ops);
5+
-- Drop the old GIST trigram index.
6+
DROP INDEX scoped_definition_search_docs_name_trigram;
7+
8+
9+
CREATE INDEX global_definition_search_name_trigram_gin ON global_definition_search_docs USING GIN (name gin_trgm_ops);
10+
DROP INDEX global_definition_search_name_trigram;

0 commit comments

Comments
 (0)