1.When database search is insufficient
A relational database's indexes (B-trees, hashes) are built to find rows by exact value or by range on a known column — "id = 5" or "created_at between X and Y." They are not built to answer "which documents contain words similar in meaning to this phrase, ranked by how relevant each one is." A LIKE '%term%' query can't use a B-tree index at all, so it falls back to scanning every row and string-matching inside it — correct, but linearly slow, and it still can't rank results, tolerate typos, understand word forms (run/running/ran), or search across many fields at once with one relevance score. Once a product needs free-text search with relevance ranking, typo tolerance, faceted filtering, or search across millions of documents with sub-second latency, that's the signal to bring in a dedicated search engine instead of asking the primary database to do more.
Key features
- A LIKE '%term%' predicate (leading wildcard) cannot use a standard B-tree index — the database scans every row and does a substring match inside it, so cost grows linearly with table size.
- Relational indexes answer "equals this value" or "falls in this range" on one or a few columns — they have no built-in concept of relevance ranking across many text fields.
- Full-text search needs typo tolerance (fuzzy matching), stemming (run/running/ran treated as related), and synonym handling — none of which a plain B-tree provides.
- Faceted filtering — narrowing results by category, price range, and tags simultaneously while keeping counts per facet — is a search-engine feature, not a SQL index feature.
- PostgreSQL's own full-text search (tsvector/GIN index) and MySQL's FULLTEXT index close part of this gap for a single database — the decision point is when ranking quality, query volume, or multi-field relevance outgrows what those built-ins handle well.
What a B-tree index handles vs. what free-text search needs
- B-tree / hash index
- Fast exact match / range on a column
- Leading-wildcard LIKE forces a full scan
- No relevance ranking, typo tolerance, or facets
- Dedicated search engine
- Native substring/leading-wildcard matching
- Relevance ranking is a core feature
- Stemming, synonyms, faceted counts built in
Command
-- This predicate cannot use a standard B-tree index:
SELECT * FROM articles WHERE body LIKE '%distributed consensus%';
-- Postgres/MySQL will scan every row and string-match inside it.A B-tree finds exact values and ranges; it can't rank relevance, tolerate typos, or match leading wildcards without a full scan. Reach for a dedicated search engine once ranking, fuzzy matching, or faceting outgrows the database's built-in full-text search — not before.