Code Room
System designMediumsd-g081
Subject AutocompleteLevel Mid–Senior~40 minCommon in Databases & SQL interviewsIndustries Technology

Question

Design a query-suggestion (search-as-you-type) system for a large web search engine that suggests full queries from prefixes, learned from aggregate query logs. Scale: billions of queries/day feeding the suggestions, p99 under 50ms, suggestions must reflect trending queries within hours, and must suppress offensive/illegal/PII-leaking completions.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.