Databricks-DE-Pro Cost and Performance Optimization Practice Question
A Spark job is failing with an OutOfMemoryError (OOM) during a group-by operation on a skewed key. What is the most effective way to resolve this?
⚠ Common exam trap
Candidates often suggest increasing cluster size (vertical scaling) or memory settings. These are inefficient 'band-aid' fixes that do not address the root cause of uneven data distribution.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use the 'salting' technique by adding a random prefix to the skewed key.
Data skew occurs when one key contains a disproportionate amount of data, causing one task to process significantly more than others. Salting (adding a random prefix to the key) breaks this concentration, distributing the data evenly across the cluster. This prevents individual tasks from crashing due to memory limits, allowing the job to complete successfully and efficiently by balancing the workload across all available workers.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the executor memory size for all workers in the cluster.
Why it's wrong here
Increasing memory is a reactive, inefficient fix. If the data skew is severe, the skewed task will eventually exhaust even larger memory allocations. It is better to address the underlying data distribution problem rather than simply throwing more resources at a bottleneck that cannot scale linearly with memory.
- ✓
Use the 'salting' technique by adding a random prefix to the skewed key.
Why this is correct
Salting distributes the skewed data across multiple tasks by adding a random prefix to the grouping key. This ensures that the heavy skewed key is spread out, preventing any single task from hitting memory limits. It is a robust, standard solution to handle data skew in Spark.
- ✗
Remove the group-by clause and process the data using a UDF.
Why it's wrong here
Using a UDF instead of a native Spark operation is generally slower and harder for the optimizer to optimize. Furthermore, it does not solve the data skew problem. The skewed data will still arrive at a single point of processing, likely resulting in the same OOM error.
- ✗
Reduce the number of executors to force the job to run sequentially.
Why it's wrong here
Running the job sequentially does not resolve the memory limit issue; it only slows down the entire process. The skewed partition will still require the same amount of memory to process, and the job will continue to crash while taking significantly longer to fail, which is counterproductive.
Visual reference
About these practice questions
This Databricks-DE-Pro question is part of Courseiva's 267-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-DE-Pro practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-DE-Pro exam.