Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**repartition(n)**: Full shuffle; increase or decrease partitions. Use when needing more parallelism or redistribute after skew. **coalesce(n)**: Reduces without full shuffle; merges adjacent. Use when reducing before write (e.g., fewer files). **Scalability**: repartition...
repartition(n): Full shuffle; increase or decrease partitions. Use when needing more parallelism or redistribute after skew. coalesce(n): Reduces without full shuffle; merges adjacent. Use when reducing before write (e.g., fewer files). Scalability: repartition expensive; coalesce cheaper for reduction. Cost: coalesce(1) = single-partition bottleneck on large data—avoid. repartition by column for partition pruning on write.
Red Flag: coalesce(1) on huge dataset—single executor. Pro-Move: 'repartition(200) before join; coalesce(20) before write for file count.'
According to DataEngPrep.tech, this is one of the most frequently asked SQL interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.