Client debounces keystrokes (150–250ms) and aborts stale fetches. Backend reads from an in-memory/Redis prefix trie or precomputed prefix-to-top-10 map (updated offline/periodically from aggregated query logs rather than on every keystroke) behind edge CDN caching for top prefixes, with Postgres pg_trgm or search index fallback for long-tail queries.
Follow-up Interview Question · How do you filter out offensive or stale trending suggestions quickly without rebuilding the whole trie?