December 6, 2025
Data Engineering Interview Prep Series — Part 5: Performance Optimization Questions You Must Master
How to fix slow SQL queries, optimize PySpark jobs, and reduce cloud costs in data pipelines.

By Ankur Gupta
2 min read
Why Optimization Interviews Matter
Companies today deal with:
- Heavy data volumes
- Expensive compute costs
- Real-time demands
- Slow dashboards = business loss
Interviewers want engineers who think in performance + cost from day one.
These questions reflect real production scenarios — not theory.
Q1 — A SQL Query Is Extremely Slow. What Do You Check First?
Expected structure of the answer:
1️⃣ Check execution plan 2️⃣ Look for full table scans 3️⃣ Ensure proper filter order 4️⃣ Push filtering closer to the source 5️⃣ Add indexing only where beneficial
Smart tip to mention: ✔ Avoid using functions on indexed columns in WHERE clause ✔ Avoid SELECT *
Q2 — How Would You Fix Data Skew in PySpark?
Show practical knowledge:
✔ Salting technique for hot keys ✔ Broadcast small datasets ✔ Repartition on evenly distributed column ✔ Avoid wide transformations early (like groupBy)
Bonus: Detect skew with frequency analysis.
Q3 — A Spark Job Fails Due to Out-of-Memory Errors
Must mention:
- Increase parallelism
- Persist only reusable data
- Use Parquet instead of CSV
- Optimize shuffle partitions
- Use caching only when needed
"Memory misuse kills performance."
Q4 — How Do You Speed Up a Slow Join?
Answer should include:
✔ Broadcast join for small lookup tables ✔ Use equality joins over non-equality conditions ✔ Pre-filter data before joining ✔ Ensure join keys are clean + partitioned
Mention: Join order matters in PySpark.
Q5 — Cloud Warehouse Bill Shot Up Overnight. What Do You Do?
You score HIGH if you mention:
✔ Investigate long-running queries ✔ Set query timeout + warehouse auto-suspend ✔ Materialize repeated transformations ✔ Improve clustering/partition pruning ✔ Limit access for experimental users
"Cost optimization is performance optimization."
Q6 — How Do You Optimize Streaming Workloads?
Key methods:
✔ Use checkpointing efficiently ✔ Set proper watermarking thresholds ✔ Drop unused fields early (narrow transformations) ✔ Tune consumer group size ✔ Autoscaling based on lag
Q7 — Partitioning Strategy Design
Explain based on access pattern:
✔ By event_date for time-series ✔ Avoid high-cardinality columns ✔ Separate cold vs hot storage ✔ Use compaction for small files problem
Mention this and interviewer smiles:
"Partitioning improves both performance and cost."
Q8 — Detecting Performance Bottlenecks
Tools to mention:
- Spark UI
- Query Explain Plan
- Cloud monitoring metrics
- Job-level logging
- Data quality insights for upstream issues
Interviewer expects visibility mindset.
Q9 — When Would You Use Caching?
Correct usage:
✔ When data is reused multiple times ✔ Dataset is small enough ✔ After expensive transformations
Wrong usage: Caching everything = slowdowns + memory errors
Q10 — Incremental Processing vs Full Reloads
Explain business outcome:
- Saves cost + time
- Beneficial when only 5–20% of data changes daily
- Must ensure CDC detection and dedupe logic
Add:
Full reload only when history logic changes.
What Interviewers Want to Hear
✔ You think about scalability ✔ You understand cloud billing ✔ You optimize for SLAs + production reliability ✔ You prevent future failures — not just fix current ones
The best data engineers justify every performance decision.
Part 6 Coming Up Next…
Data Quality & Observability Interview Questions — Real Rules + Automation Strategies, Including: Null + schema drift handling DLQ management Freshness SLAs Python/PySpark validation examples