# CPU Utilization Summary

> The CPUs are working. How hard?

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

Domain: SQL · Difficulty: easy · Seniority: L3

## Problem

The capacity planning team wants a one-line summary of fleet-wide CPU health: the minimum, average, and maximum CPU utilization across all infrastructure nodes.

## Worked solution and explanation

### Why this problem exists in real interviews

This tests basic aggregate functions (MIN, AVG, MAX) without GROUP BY. It produces a single summary row, screening for fundamental aggregate fluency.

---

### Break down the requirements

#### Step 1: Compute three aggregates

`MIN(cpu_pct)`, `AVG(cpu_pct)`, and `MAX(cpu_pct)` in a single SELECT without GROUP BY produces one summary row.

---

### The solution

**Fleet-wide aggregate summary**

```sql
SELECT
    MIN(cpu_pct) AS min_cpu,
    AVG(cpu_pct) AS avg_cpu,
    MAX(cpu_pct) AS max_cpu
FROM infra_nodes
```

> **Cost Analysis**
>
> Scan of 6K rows. Trivially fast. All three aggregates are computed in a single pass.

> **Interviewers Watch For**
>
> Whether the candidate produces a single-row result vs grouping by something. No GROUP BY is needed for a fleet-wide summary.

> **Common Pitfall**
>
> If cpu_pct contains NULLs, AVG ignores them automatically. But the MIN/MAX might not represent the full fleet. Consider adding `WHERE cpu_pct IS NOT NULL` if NULLs are meaningful (e.g., offline nodes).

---

## Common follow-up questions

- How would you break this down by region? _(Add GROUP BY region.)_
- What if you also needed the standard deviation? _(Add STDDEV(cpu_pct) or STDDEV_POP(cpu_pct).)_
- How would you identify nodes in the top 5% of CPU utilization? _(Tests PERCENTILE_CONT or NTILE for percentile-based filtering.)_

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/cpu_utilization_summary)
- [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.