Design an Interactive SQL Notebook
Design a notebook where users run read-only SQL and retrieve durable results without overwhelming the browser or query workers.
Problem statement
For this exercise, assume you are designing an interactive SQL notebook for users who explore data through ordered SQL cells. A user can save a notebook, run one cell against a preconfigured read-only data connection, observe the execution state, and retrieve the result after it completes.
Results may be much larger than a browser can hold, so the client must retrieve them incrementally and must be able to resume after a refresh or disconnect. Each submitted execution is immutable: its SQL text, connection reference, status, and result pages belong to one execution ID.
A successful status may be exposed only after the complete result manifest is durable. Scope cancellation, retries, overload, authorization, and result expiry; exclude collaborative editing, arbitrary database administration, query optimization, and writes to source databases.
What to build
- Users can create and save a notebook containing an ordered set of SQL cells.
- Users can submit a cell for read-only execution and observe queued, running, succeeded, failed, or cancelled status.
- Users can retrieve a completed execution's schema and rows incrementally, then resume retrieval after reconnecting.
- Users can request cancellation and receive an unambiguous final execution outcome.
At scale
- At peak, accept 2,000 execution submissions per second and support 10,000 concurrently running executions; excess work may queue instead of overloading query workers.
- A completed result may contain up to 1 million rows or 100 MB, and the first result page should be available within 1 second after execution succeeds.
- Notebook metadata is durable, while completed execution results are retained for 24 hours and may then expire.
- Submission retries must not create duplicate executions, and a succeeded execution must never expose a partial or mixed-version result.