Google BigQuery (50 Qs)•Part 3: Enterprise FinOps, Disaster Recovery & Scale (25 - 35)
Query Plan Execution and Optimization: Diagnosing "Resources exceeded during query execution".
senior LevelPerformance
In Simple Words:
When a query fails with Resources exceeded:
- Root Cause: The query exceeded the memory allocated to worker slots during an in-memory hash shuffle or sort.
- Troubleshooting Steps:
- Inspect Query Plan Execution Details in BigQuery console.
- Look for stages with high Wait Time (indicates slot starvation) vs high Compute Time.
- Data Skew: If one slot took 10 minutes while all others took 2 seconds, check for skewed join keys (e.g.
ON a.user_id = b.user_idwhereuser_idis frequentlyNULL). - Avoid
ORDER BYon un-aggregated tables without aLIMITclause.