VAYULearn
Colour theme
Investigate a failure
VAYU Learn

SQL & Databases

50 SQL Interview Questions Every Data Engineer Must Know — Expert Edition - Part 2

For Staff+, Platform, and Lakehouse-Focused Data Engineers

SQL & DatabasesDatabricks & LakehouseData Architecture & ReliabilityCareer & Interview

If Expert Edition — Part 1 was about how SQL executes,
Part 2 is about where SQL lives.

This is the layer most engineers never fully understand:

  • Storage engines
  • Metadata
  • MVCC
  • File pruning
  • Compaction
  • CDC
  • Transactional guarantees
  • Lakehouse internals

At this level, interviews stop testing queries and start testing system thinking.


⭐ TL;DR — What This Part Covers

This blog focuses on SQL beyond the query engine:

  • Lakehouse internals (Delta / Iceberg / Hudi)
  • Metadata-driven execution
  • File pruning & partition elimination
  • MVCC & snapshot isolation
  • Compaction & small-file problems
  • CDC deduplication patterns
  • Transaction semantics
  • Exactly-once guarantees
  • Incremental SQL pipelines
  • Real-world failure modes

If Part 1 made you query-plan fluent,
Part 2 makes you storage-aware.


🔍 Previous in This Series

👉 🎯 50 SQL Interview Questions — Basics Edition
👉 🧠 50 SQL Interview Questions — Advanced Edition (Part 1)
👉 🧠 50 SQL Interview Questions — Advanced Edition (Part 2)
👉 🧠 50 SQL Interview Questions — Expert Edition (Part 1)

If you’re here, you’re already operating at senior-to-staff level.


🧩 Topic Distribution (Expert Level)

Total: 50 questions


🧱 SECTION A — Lakehouse Storage Internals (12 Qs)

1. What problem does a Lakehouse solve compared to traditional warehouses?
Answer:
Unifies storage, analytics, and ML on object storage with ACID guarantees.

2. How does Delta Lake ensure ACID transactions on S3?
Answer:
Transaction logs (_delta_log) + optimistic concurrency control.

3. What is Iceberg metadata and why does it matter?
Answer:
Manifest lists and metadata tables enable snapshot isolation and fast planning.

4. Delta vs Iceberg — key internal difference?
Answer:
Delta uses log-based commits; Iceberg uses immutable metadata trees.

5. What is snapshot isolation in Lakehouses?
Answer:
Readers always see a consistent snapshot, regardless of concurrent writes.

6. Why are Lakehouse reads often faster than expected?
Answer:
Metadata pruning and file-level statistics eliminate unnecessary scans.

7. What happens when two writers update the same table?
Answer:
Optimistic concurrency — one commit wins, the other retries.

8. What is time travel and how is it implemented?
Answer:
Snapshots preserved via logs/manifests; queries reference versions or timestamps.

9. Why is schema evolution safe in Delta/Iceberg?
Answer:
Schema is stored in metadata; readers interpret files using table schema.

10. What is copy-on-write vs merge-on-read?
Answer:
Copy-on-write rewrites files; merge-on-read defers merging until query time.

11. Why is object storage ideal for Lakehouses?
Answer:
Cheap, scalable, immutable — ideal for versioned data.

12. What breaks Lakehouse performance most often?
Answer:
Small files and poor partitioning.

❌ Weak interview answer
“Lakehouses give ACID guarantees on object storage using logs and metadata.”
✅ Staff-level answer
“Lakehouses replace warehouse locking with optimistic concurrency and versioned metadata.
Performance and correctness depend on metadata growth, conflict rates, and file rewrite behavior — not SQL syntax.”
🚨 Production smell
Commit retries spike during peak hours → concurrent writers are fighting optimistic concurrency.

📁 SECTION B — File Pruning & Metadata (10 Qs)

13. What is partition pruning?
Answer:
Skipping partitions using partition column filters.

14. What is file pruning?
Answer:
Skipping files using min/max statistics in metadata.

15. Why is file pruning more powerful than partition pruning?
Answer:
It works even without partition columns.

16. Why does filtering on non-partition columns still scale well?
Answer:
Column-level statistics enable file elimination.

17. What happens when stats are missing?
Answer:
Full scans → massive performance drops.

18. Why is WHERE date >= '2025-01-01' fast on Lakehouse tables?
Answer:
Predicate pushdown plus metadata pruning.

19. How does Z-Ordering help?
Answer:
Co-locates related columns for better pruning.

20. Why does SELECT * kill pruning?
Answer:
Forces scanning all columns and files.

21. What metadata tables exist in Iceberg?
Answer:
Snapshots, manifests, partitions, files.

22. Why do engineers underestimate metadata importance?
Answer:
They think performance is about SQL, not storage layout.

❌ Weak interview answer
“Partitioning improves performance by reducing scans.”
✅ Staff-level answer
“Partitioning is a coarse filter. Real scalability comes from file-level statistics and metadata pruning.
When stats are missing or stale, planning time explodes even if execution is trivial.”
🚨 Production smell
Query planning takes longer than execution → metadata tables or file stats are broken.

🔄 SECTION C — Compaction & File Management (8 Qs)

23. What is the small-file problem?
Answer:
Too many tiny files cause planning and IO overhead.

24. How do small files impact SQL queries?
Answer:
More tasks, more metadata reads, more shuffles.

25. What is compaction?
Answer:
Merging small files into fewer large ones.

26. When should compaction run?
Answer:
Off-peak, after heavy ingestion.

27. Why is auto-compaction critical in streaming pipelines?
Answer:
Streaming produces micro-files continuously.

28. What happens if you never compact?
Answer:
Query latency degrades over time.

29. Why is compaction a storage concern, not SQL logic?
Answer:
It changes file layout, not query semantics.

30. How do Delta/Iceberg track compacted files safely?
Answer:
Via atomic metadata updates.

❌ Weak interview answer
“Compaction merges small files to improve performance.”
✅ Staff-level answer
“Compaction is a tradeoff between write amplification, query latency, and metadata growth.
Poor compaction strategies silently destroy SLAs months after launch.”
🚨 Production smell
Table size grows slowly but query latency grows fast → unmanaged small files.

🔁 SECTION D — CDC & Incremental SQL (8 Qs)

31. What is CDC in SQL pipelines?
Answer:
Capturing inserts, updates, and deletes from source systems.

32. Why is CDC hard in SQL?
Answer:
Multiple versions per key and ordering issues.

33. How do you deduplicate CDC records?
Answer:
ROW_NUMBER() over key ordered by operation timestamp.

34. Why is late-arriving data dangerous?
Answer:
It can overwrite newer state.

35. How do Lakehouses handle CDC safely?
Answer:
Versioned commits plus snapshot isolation.

36. What is upsert in Lakehouse SQL?
Answer:
MERGE INTO semantics.

37. Why can MERGE be expensive?
Answer:
It requires file rewrites.

38. How do you optimize CDC pipelines?
Answer:
Partition by key/time and compact frequently.

❌ Weak interview answer
“We deduplicate CDC using ROW_NUMBER and MERGE.”
✅ Staff-level answer
“CDC correctness depends on ordering guarantees, idempotency, and replay behavior.
SQL deduplication only works when the storage layer enforces snapshot isolation and commit ordering.”
🚨 Production smell
MERGE latency grows linearly with table age → full-file rewrites combined with key skew.

🔐 SECTION E — Transactions & Isolation (6 Qs)

39. What isolation level do modern warehouses use?
Answer:
Snapshot isolation via MVCC.

40. Why is READ COMMITTED insufficient for analytics?
Answer:
Results can change mid-query.

41. How does MVCC work in simple terms?
Answer:
Readers see old versions; writers create new ones.

42. Why are locks avoided in Lakehouses?
Answer:
They don’t scale on object storage.

43. How do conflicts get resolved?
Answer:
Optimistic retries at commit time.

44. Why is snapshot isolation ideal for BI?
Answer:
Consistent results without blocking writes.

❌ Weak interview answer
“Snapshot isolation prevents dirty reads.”
✅ Staff-level answer
“Snapshot isolation trades write conflicts for read consistency.
At scale, conflict frequency — not isolation level — determines throughput.”
🚨 Production smell
Throughput collapses as writers increase → conflict rate exceeds retry budget.

⚠️ SECTION F — Failure Modes & Traps (6 Qs)

45. What happens if metadata grows too large?
Answer:
Planning time explodes.

46. Why is over-partitioning worse than under-partitioning?
Answer:
Too many directories and small files.

47. Why does performance degrade over months?
Answer:
Unmanaged file growth and stale stats.

48. What breaks MERGE pipelines in production?
Answer:
Skew and concurrent writers.

49. Why is SQL correctness not enough?
Answer:
Correct SQL can still be unscalable.

50. What defines an expert SQL data engineer?
Answer:
They understand query, engine, and storage as one system.

❌ Weak interview answer
“Performance degraded because the data got bigger.”
✅ Staff-level answer
“Performance degraded because metadata, file count, or write amplification grew faster than data volume.”
🚨 Production smell
Dashboards disagree across refreshes → snapshot isolation misunderstood or violated.

🧩 Conclusion — SQL Is a Storage Problem Now

At expert level:

  • SQL performance is metadata-driven
  • Bugs come from file layout, not syntax
  • Scaling requires storage-aware design
  • Lakehouse SQL is systems engineering

If you understand:
✔ execution
✔ cost
✔ metadata
✔ MVCC
✔ compaction
✔ CDC

You’re no longer “good at SQL.”
You’re designing data platforms.


🔥 Next in Series

👉 How to Read and Debug SQL Query Plans Like a Staff Data Engineer

We’ll go line-by-line through:

  • Spark plans
  • Snowflake profiles
  • Real production failures
  • Why queries look fine but melt clusters

This is where theory meets reality.


🔔 Follow for More

Follow TheDataForge for high-signal deep dives on Spark, Kafka, Streaming, Lakehouse, and real-world data engineering — no fluff, only engineering truth.

⚡️Let’s connect — I post daily Big Data & Spark insights at DataForgeX on X.

💬 Comment Below: Which topic should get a full deep-dive next?

  • Lakehouse internals
  • MERGE & CDC patterns
  • Compaction strategies
  • Metadata tuning
  • Query plan debugging

🏷️ Tags

#SQL #DataEngineering #Lakehouse #DeltaLake #ApacheIceberg #DistributedSystems #QueryOptimization #Interviews #DataForge