CODE WORKSPACE

Interview query-cost triage

Return query triage labels for expensive, wide, or full-scan query runs.

Start by naming the output grain, then build CTEs that can be inspected one at a time.

Sample input

query_runsTriage cost from bytes scanned and partitions touched.
query_idquery_labelgb_scannedpartitions_scanned
2orders_export2408
6adhoc_select_star1808
4event_funnel856

Expected output

Expected outputHigh-byte all-partition scans are full_scan_review; mid-cost scans are expensive_review.
query_idtriage_status
2full_scan_review
6full_scan_review
4expensive_review

Constraints

State the output contract first, use readable CTE layers, return the exact columns requested by the prompt, and use deterministic ordering.

Expected skills

Interview clarification, SQL structure, edge-case handling, and final-answer narration.

SQL
Loading...

AI evaluation

Run the SQL query to inspect preview rows.