Design an Interactive SQL Notebook or Query Execution Service
Design the service behind an interactive SQL notebook, or an online-judge-like service that runs submitted queries. The emphasis is on how users submit queries and how clients receive results: a query can take seconds or minutes, a user may close the tab and come back, results can be very large, and one user's heavy queries must not starve everyone else.
Cover the submit API and the query record, how work is scheduled onto isolated workers, where results live and how a client reads them, cancellation, and what happens when a client disconnects mid-query.
Hints
Hint 1
submit(query, session) validates, stores a record in state QUEUED and returns a query id immediately; an idempotency key makes a double-click harmless.
Hint 2
Workers stream result batches to object storage and advance the record through RUNNING to SUCCEEDED, FAILED or CANCELLED; the client fetches result pages by cursor from storage, never through the worker's connection.
Hint 3
Compare polling, long polling and server-sent events for progress; pick one and say what it costs.
Asked at
Sign in to talk to the interviewer — ask what's in scope, what scale to design for, or for a nudge when you're stuck. Conversations save to your account.