Fast Search Using PostgreSQL Trigram Text Indexes
Mar 18, 2016Yorick Peterse

Summary
This post details the implementation of PostgreSQL trigram indexes for improved search performance in GitLab 8.6. It explains how trigram indexes work, the challenges with traditional LIKE conditions and full-text search, and the specific implementation details for GitLab, including adapting Rails to support GIN indexes with the `gin_trgm_ops` operator class and ensuring compatibility with MySQL by ignoring PostgreSQL-specific options. The post quantifies the performance improvement with a 946x speedup on a sample query.