2 min lesson
Technical screen: SQL + applied stats
Work through the cases in "Technical screen: SQL + applied stats", pairing each signal with the move that fits.
Step 1 of 2
The ~60-minute technical screen is where most candidates either look fluent with interaction data or look like they last wrote a window function from memory. Expect to query event and interaction tables live and to reason out loud about what makes a metric trustworthy. They watch your rigor as much as your final answer.
The data is shaped like Cursor's world: users, sessions, agent runs and tool calls, with retries, timeouts and heavy-tailed latency baked in. The skill on display is turning a fuzzy question into a precise, runnable query without hand-waving.
Window functions: ranking, running totals, lag/lead for deltas.
Sessionization: grouping events into sessions and runs by gap.
Funnels: step conversion across an interaction lifecycle.
Percentile latency: p50/p95/p99 with PERCENTILE_CONT.
Dedup of retries: collapsing repeated attempts into one logical run.
Real regression vs noise: effect size against day-to-day variance.
Observation window: how long to watch before you trust the read.
Confounds: deploys, traffic mix shifts, model swaps.
Why averages mislead on heavy-tailed latency.
Segmentation and Simpson's paradox on aggregate numbers.
Before you type, say the metric definition out loud. The bar is that someone could run your query tomorrow and get the same number.
WITH final_attempts AS (
SELECT run_id,
user_id,
DATE(started_at) AS day,
latency_ms,
ROW_NUMBER() OVER (
PARTITION BY run_id
ORDER BY attempt_no DESC
) AS rn
FROM agent_runs
WHERE status = 'completed'
)
SELECT day,
COUNT(*) AS runs,
PERCENTILE_CONT(0.95) WITHIN GROUP (ORDER BY latency_ms) AS p95_ms
FROM final_attempts
WHERE rn = 1
GROUP BY day
ORDER BY day;Out loud, every time: row counts against what you expected, null rates on the join keys and whether the distribution is as skewed as you assumed. A p95 that looks too clean usually means retries were not collapsed or a timeout cap is truncating the tail.
Learn more
Full explanation
Full explanation
Narrate your assumptions as you go: “I'm treating a run as the final attempt, so I'm collapsing retries - flag me if the metric should count every attempt.” Naming the fork shows you know metric definitions are choices and it lets the interviewer steer instead of silently marking you wrong.
QYou report mean agent-run latency rose from 800ms to 1.2s after a deploy. Why might the mean mislead and what would you compute instead?