Engineering 3 min read Updated
In-app search: SQL, full-text or search engine?
In short
Product and admin search does not start with a separate search cluster. Match the search backend to catalogue size, typo tolerance, faceting and sync complexity.
Every product eventually needs a search box—for orders in an admin panel, articles on a help centre, or products in an online shop. Teams often jump straight from slow LIKE '%term%' SQL queries to standing up a separate search cluster, adding an entire indexing pipeline before they need it. Choosing the simplest search architecture that meets your real latency and ranking needs saves months of sync bugs.
Three tiers of in-app search compared
| Approach | Best fit | Sync complexity | Limitations |
|---|---|---|---|
| Indexed SQL prefix / exact match | SKUs, order IDs, emails, small tables under a few thousand rows | Zero (single source of truth) | No relevance ranking, weak multi-word matching; %term% scans every row |
| Database full-text (PostgreSQL / SQLite FTS5) | Catalogues, notes, B2B workspaces up to hundreds of thousands of rows | Zero or automatic triggers inside the same DB transaction | Limited typo tolerance without trigram indexes; heavy dynamic facet counts need care |
| External search engine | Large multi-attribute e-commerce catalogues, typo tolerance, weighted synonyms, fast faceted counts | High: async outbox/queue sync, schema mapping, full reindex jobs | Second stateful service to host, back up, secure and monitor |
Why SQL LIKE breaks first—and how far database full-text goes
A leading wildcard such as WHERE title LIKE '%cable%' cannot use a standard B-tree index (Database indexes). On 500 rows nobody notices; on 200,000 rows every keystroke in a live search box triggers a full table scan and stalls the database.
Built-in full-text search solves that problem without adding another server. PostgreSQL’s Full Text Search tokenises text into lexemes (with GIN indexes and optional pg_trgm for substring/typo matching), while SQLite’s FTS5 extension provides fast BM25-ranked full-text queries inside the same file. Both keep search results immediately consistent with writes because updates happen in the same database transaction.
When an external search engine earns its cost
Move to a dedicated search engine only when real user queries hit clear limits of relational full-text:
- Heavy faceting with dynamic counts: e-commerce filters showing live item counts across dozens of attributes simultaneously (see Pagination and facets).
- Typo tolerance and domain synonyms: users searching misspelled brand names or Czech/Slovak/English variants where rigid exact-stem matching returns zero results.
- Scale and isolation: multi-million document indices where heavy search aggregations would steal CPU and memory from checkout or transactional database writes.
Search UI details that matter as much as the backend
Fast search feels broken if the browser freezes while typing. To protect responsiveness (Interaction to Next Paint (INP)):
- Debounce live-suggest requests (for example 200–300 ms) and abort superseded in-flight fetch() calls with AbortController.
- Keep a minimum query length (2–3 characters) before running wildcard or prefix suggestions.
- Support exact-identifier shortcuts (order number, SKU, EAN) so staff and repeat buyers jump straight to the exact record.
- Always enforce tenant and permission filters inside the search query itself—never filter unauthorised rows only in the UI.
If you adopt an external search engine, build a repeatable full-reindex command from day one. Index drift between the database and search service is inevitable after deploys or partial queue failures.
Slow product search or broken filters hurting conversion? Share the catalogue structure through our enquiry form.
Common questions
- Why does SQL LIKE '%term%' slow down as tables grow?
- A leading wildcard prevents a standard B-tree index from narrowing the scan, forcing the database to read every row and check substrings sequentially.
- When is built-in database full-text search enough?
- PostgreSQL full-text search or SQLite FTS5 handles tens or hundreds of thousands of documents cleanly with zero sync lag, transactional consistency and language stemming when you do not need heavy cross-facet analytics or complex typo ranking.
- What is the hidden operational cost of an external search engine?
- Every create, update and delete must stay synchronised between your primary database and the search index, requiring retry queues, periodic full reindexing and tenant permission filtering on search queries.
Sources
- Full Text Search, PostgreSQL Documentation. Accessed 24 November 2026
- SQLite FTS5 Extension, SQLite Documentation. Accessed 24 November 2026
- Interaction to Next Paint (INP), web.dev (Google). Accessed 24 November 2026
Further reading
-
When a database index helps and when it only adds cost
An index helps when a frequent query can use it to find, filter or sort rows, and every write pays for it, so add one only for a query you actually run.
-
SQLite or MySQL for a small product
Choose SQLite when one application on one host reads and writes the data and writers can take turns; choose MySQL when many machines or simultaneous writers share it.
-
Pagination and faceted navigation for search
Give each page its own plain link and URL, and either block filter combinations you do not need in Search or keep them crawlable and return a 404 when they are empty.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea