Question of the Day5 Dec 2026
SparkAdvancedProduction scenarioAbout 2 minutes
A join on customer_id has 200 tasks. 199 finish in a minute; one runs for 40 minutes. What is the best first fix?
Show the answer
Answer: Turn on adaptive query execution's skew-join handling, and salt the hot key if it is still slow
One slow task means one partition holds far more rows: a skewed key. AQE (on by default since Spark 3.2) can split skewed partitions; salting spreads a hot key over several partitions. More memory or more partitions leave the hot key in one task.In production: Check the Spark UI first: a stage where the max task time is many times the median, with one task reading far more shuffle data, is skew. Fix the data shape (salting, splitting the hot key, or filtering junk keys such as NULL or "unknown") rather than adding executors, which leaves the hot key on one task.
