Skip to lesson
Exit
Reliability Analytics & Self-Serve Tooling1 / 3

2 min lesson

SQL & Python craft for scale

Explain what the example in "SQL & Python craft for scale" is doing and why it matters.

Step 1 of 3

Cursor publishes no interview stages, but the posting's charter points at SQL on event data and applied stats. Rehearse as if you'll be asked to pull p95 latency by model from a billion-row table without melting the warehouse, and to make that number rerunnable tomorrow.

Prepare three skills: window functions for sessionization and funnels, percentile aggregations for latency, and cost-aware querying so your scan touches partitions instead of the whole table. Show all three on one realistic problem and you've covered the ground the charter implies.

Learn more

Advanced table

Cost-aware querying on billions of rows

Cost-aware querying on billions of rows

Technique
Partition pruning
What it buys
Scan days, not years
When to reach for it
Always: filter on the partition key first
Technique
Pre-aggregation / rollups
What it buys
Dashboards read a small table
When to reach for it
Repeated, well-known reliability questions
Technique
Sampling
What it buys
Fast exploratory answers
When to reach for it
Iterating on a hypothesis, not a final number
Technique
Approximate quantiles
What it buys
Tail metrics at scale
When to reach for it
p95/p99 over huge groups
Technique
Column pruning
What it buys
Less I/O on wide event tables
When to reach for it
Select only the columns you need

On billions of rows, the query plan is part of the analysis, and a correct number you can't afford is not an answer.

Python for log analysis and detection

SQL gets you aggregates; Python gets you the modeling SQL can't express. Pull a manageable slice with pandas or polars, run hypothesis tests with scipy/statsmodels and prototype lightweight detection, such as a change-point or anomaly check, before anyone builds the production version.

Is the canary's success rate really lower? A proportions test, not eyeballing
from statsmodels.stats.proportion import proportions_ztest

# successes / totals for control arm vs canary arm, same window
successes = [control_success, canary_success]
totals    = [control_total,   canary_total]

stat, pval = proportions_ztest(count=successes, nobs=totals)
delta = canary_success / canary_total - control_success / control_total
print(f"success-rate delta={delta:+.3%}  p={pval:.4f}")
# A real regression should clear significance AND be large enough to matter
# Pre/post needs a time-matched baseline; cluster by user or bootstrap when attempts correlate
Significant is not the same as material

At billions of interactions, a 0.01% change is statistically significant and operationally meaningless. Always pair the p-value with the effect size and a materiality bar: does this move the error budget, and does it affect a meaningful number of users? Reporting significance alone in this role reads as junior.