The Problem with LIKE Queries When users start typing a search query, they expect instant suggestions. A naive WHERE title LIKE '%query%' approach has two problems: it can't use indexes (the leading % prevents it), and it doesn't handle typos or misspellings. At DailyWatch , we needed autocomplete that's both fast and forgiving. PostgreSQL's pg_trgm extension solves both problems elegantly. What Are Trigrams? A trigram is a group of three consecutive characters from a string. The word "video" produces these trigrams: " v", " vi", "vid", "ide", "deo", "eo " . PostgreSQL uses trigram overlap to measure how similar two strings are, which naturally handles typos.…