Is PostgreSQL pg_trgm Good Enough for Fuzzy Search?
How a simple data science habit—a tiny eval set and accuracy@k—helped engineers and PMs turn "this looks okay" into a defensible decision in one hour.
The problem
Our product lets users search a database of emission factor names. Think entries like "Copper products", "Crude petroleum and services related to crude oil extraction, excluding surveying", or "Aluminium and aluminium products". Users type short, messy queries: typos ("cupper"), partial names ("crude petroleum"), regional spellings ("aluminum" vs "aluminium").
We were migrating search off a dedicated search engine and onto plain Postgres. The question on the table:
Can an out-of-the-box Postgres extension (
pg_trgm) give us good enough search, or do we need something heavier: embeddings, a vector database, a Hugging Face model, a custom bag-of-words ranker?
With AI, a product manager or engineer can quickly implement several PostgreSQL search options, even without deep search expertise. The same tools can also help simulate realistic user queries and build a small evaluation set in under an hour. That makes it possible to compare the options with evidence instead of stopping at "this looks okay."