pg_trgm
A trigram similarity extension for PostgreSQL that enables fuzzy matching and similarity computation by splitting text into trigrams, commonly used to handle spelling errors and approximate search scenarios.
Timeline (last 90 days)
pg_trgm is an official PostgreSQL extension that splits a string into trigrams made of three consecutive characters, and by comparing the proportion of trigrams shared by two strings it calculates a similarity score between 0 and 1, thereby tolerating typos, missing characters, or reversed word order.
LectuLibre builds a gin_trgm_ops index on books.title, and at query time filters with similarity(Book.title, q) > 0.3 and sorts by similarity, reducing fuzzy title search from 1.2s to 15ms.
All Facts (2)
pg_trgm is an official PostgreSQL extension that splits a string into trigrams made of three consecutive characters, and by comparing the proportion of trigrams shared by two strings it calculates a similarity score between 0 and 1, thereby tolerating typos, missing characters, or reversed word order.
50%UnverifiedLectuLibre builds a gin_trgm_ops index on books.title, and at query time filters with similarity(Book.title, q) > 0.3 and sorts by similarity, reducing fuzzy title search from 1.2s to 15ms.
50%