Flag Storage Aggregates Projected to Fill Within Thirty Days
Last updated: November 29, 2026
Quick Overview
Given daily capacity telemetry per storage aggregate (used and total TB), write a SQL query that fits a growth trend over the last 30 days and returns aggregates whose projected days until 95% full is under 30, ordered by urgency.
Netapp
November 29, 20260
0
0 solved
Given daily capacity telemetry per storage aggregate (used and total TB), write a SQL query that fits a growth trend over the last 30 days and returns aggregates whose projected days until 95% full is under 30, ordered by urgency.
NetApp's Active IQ (Digital Advisor) processes AutoSupport telemetry from the installed base to warn customers about capacity and health risks before they become outages. Data engineering screens on this kind of team test window functions, regression in SQL, and care about noisy telemetry such as gaps and expansions.
What the Interviewer Expects
- Restricts to a 30-day window and requires a minimum number of samples
- Uses a linear fit (regr_slope or manual least squares) rather than first versus last point
- Projects from the latest sample to the 95% threshold, not to 100%
- Excludes aggregates with flat or shrinking usage
- Handles capacity expansions where total_tb changes mid-window
- Orders results by days remaining
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- An aggregate grows in steps when a nightly backup lands. Is linear regression still appropriate?
- How would you detect and exclude a day where an admin deleted 20 TB of snapshots?
- How would you compute this incrementally for millions of aggregates every day?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table capacity_daily(system_id, aggregate_id, sample_date, used_tb, total_tb), at most one row per aggregate per day, but days can be missing when AutoSupport does not send. Threshold is 95% of curr...
Approach
Take the last 30 days per aggregate, require at least 10 samples, fit used_tb against day number with least squares to get TB per day, and project from the most recent sample. Days until full = (0.95 ...