QuestionQ1

VerifiedCost & Performance Optimisation

A data engineer runs a groupBy aggregation on a massive user-activity log, grouping by user_id. A small number of users have millions of records, resulting in task skew and long execution times.

Which technique will resolve the skew in this aggregation?

Explanation

Salting distributes records for an exceptionally frequent key across multiple temporary keys, allowing several partitions and tasks to process partial aggregates in parallel. Removing the salt and aggregating the partial results afterward produces the correct aggregate while avoiding concentration of all records for a skewed user_id in one task.

Community Discussion

No comments yet. Be the first to start the discussion!