Find Applications With the Most Blocked Flows Before Enforcement
Last updated: November 29, 2026
Quick Overview
Given a flows table with source and destination workload ids, port, policy decision and timestamp, plus a workloads table with application and environment labels, write SQL that returns, per destination application in production, the number of flows that would be blocked in the last 7 days and the top blocked port.
Illumio
November 29, 20260
0
0 solved
Given a flows table with source and destination workload ids, port, policy decision and timestamp, plus a workloads table with application and environment labels, write SQL that returns, per destination application in production, the number of flows that would be blocked in the last 7 days and the top blocked port.
Before a customer moves an application from visibility to enforcement, Illumio's tooling reports which traffic current policy would block, so teams can write missing rules first. The interviewer checks joins on labels, date filtering, aggregation and a clean way to pick a per-group top value.
What the Interviewer Expects
- Joins flows to workloads on the destination side for the application label
- Filters to the production environment and a 7-day window
- Counts only potentially blocked decisions
- Uses a window function to pick the top port per application
- Handles ties and unlabeled workloads explicitly
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
- How would you count distinct source applications instead of raw flows?
- Flows are already aggregated with a connection count column. What changes?
- How would you exclude flows from workloads that were decommissioned during the window?
- How would you make this incremental for a daily dashboard?
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
Assume flows(src_id, dst_id, port, proto, decision, ts) where decision is one of allowed, potentially_blocked, blocked, and workloads(id, app, env). One row per flow summary. Ask whether u...
Approach
Join flows to workloads on dst_id, filter env and window and decision, aggregate counts per (app, port), then rank ports within each app and keep the first. Total blocked per app is a windowed sum o...