Jan 3, 2019 Thursday

Index columns for LIKE in PostgreSQL

Postgres uses trigrams to break down strings into smaller chunks and index them efficiently. The pg_trgm module supports GIST or GIN indexes and as of Postgres version 9.1 these indexes support LIKE/ILIKE queries.

I need to test if gin_trgm_ops is faster than varchar_pattern_ops.