# High-Traffic Endpoints in February

> When traffic spikes, some endpoints get buried. How many crossed the line?

Canonical URL: <https://datadriven.io/problems/high_traffic_endpoints_in_february>

Domain: SQL · Difficulty: easy · Seniority: L4

## Problem

The API governance team is identifying high-traffic endpoints for February 2026 rate-limit tuning. How many unique endpoints received 100 or more total calls that month?

## Worked solution and explanation

### Why this problem exists in real interviews

The core skill being tested is row numbering within partitions combined with nested subqueries over `api_calls`. Candidates must decide how `endpoint`, `method`, `status` interact before choosing a join strategy or aggregation level.

---

### Break down the requirements

#### Step 1: Partition by `endpoint`

`PARTITION BY endpoint` creates groups. Within each group, `ORDER BY call_time DESC` determines the ranking.

#### Step 2: Filter to rank 1

`WHERE rnk = 1` in the outer query selects the target row per group.

---

### The solution

**Row-number for high-traffic endpoints february**

```sql
SELECT *
FROM (
    SELECT *,
           ROW_NUMBER() OVER (PARTITION BY endpoint ORDER BY call_time DESC) AS rnk
    FROM api_calls
) ranked
WHERE rnk = 1
ORDER BY endpoint
```

> **Cost Analysis**
>
> Window function sorts within each `endpoint` partition. An index on `(endpoint, call_time)` avoids a full sort.

> **Interviewers Watch For**
>
> The interviewer checks whether you use ROW_NUMBER (one row) vs. RANK/DENSE_RANK (ties) based on the prompt requirements.

> **Common Pitfall**
>
> Using GROUP BY with MIN(call_time) gives the value but not the other columns. ROW_NUMBER gives the full row.

---

## Common follow-up questions

- The `err_msg` column in `api_calls` has roughly 95% NULLs. How does your query handle those rows, and would the result change if NULLs were replaced with zeros? _(Tests whether the candidate understands how NULLs propagate through aggregation functions and whether their WHERE/JOIN conditions implicitly filter them out.)_
- Your window function uses a default frame. What is the implicit frame, and would switching to ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW change anything? _(Tests knowledge of default window frames (RANGE vs ROWS) and when the distinction matters.)_
- `call_id` in `api_calls` has ~150M distinct values. What index strategy keeps your query from doing a full table scan? _(Tests whether the candidate can design indexes for high-cardinality columns and understands selectivity.)_
- Could you express this same logic as a single query without CTEs or subqueries? What readability trade-off does that introduce? _(Tests whether the candidate can flatten nested logic and understands when decomposition aids maintainability.)_

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/high_traffic_endpoints_in_february)
- [SQL Interview Questions](https://datadriven.io/sql-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.