ETL vs ELT

Context: FIT3003_MOC · the write path of the Data Warehouse delivery chain · the unit’s labs are ETL (Model 3: PL/SQL builds the TempFact, then the fact); a Data Lakehouse is ELT · (W12 emerging-topics deck — not a book chapter) Parent Framework: Data Engineering

Quick Revision

  • 🎯 Objective: both move source data into an analytical platform ➔ they differ only in where and when the transform runs — before the load (ETL) or inside the target after it (ELT).
  • 📦 Core Components: ETL ➔ transform in a staging step | ELT ➔ land raw, transform with the target’s compute | extraction ➔ batch pull · file landing · CDC | conflict rule ➔ latest timestamp, then source priority.
  • ⚡ Key Constraint: they are complementary, not rivals — the choice depends on workload, architecture and constraints; say why the target’s compute or the staging step should do the work.

📝 How It Works

1. The two orders

  • ETL ➔ Extract from sources ➔ Transform and validate ➔ Load the prepared data into the warehouse.
  • ELT ➔ Extract ➔ Load into the target platform ➔ Transform there, using the platform’s own processing.
  • Modern pipeline capabilities (either order) ➔ incremental loading · workflow orchestration · data-quality testing · error handling and recovery · monitoring and lineage.

2. Extraction — three ways in

  • Batch pull ➔ JDBC read an incremental filter (WHERE login_time > last_load_time) so each run takes only new rows.
  • File landing ➔ Auto Loader watches S3 / ADLS and streams each new file into Raw.
  • CDC (change data capture) ➔ Debezium ➔ Kafka: every operational insert/update becomes an event — the streaming form of the active warehouse idea (Ch 18).

3. Conflict resolution — Raw ➔ Cleaned

  • Rule ➔ for each key, the latest timestamp wins; ties broken by source priority.
  • Concurrent writers ➔ Delta’s optimistic concurrency: two writers proceed, the loser retries.

⚙️ Core Implementation

🔹 File landing into Raw (Spark Auto Loader)

🔹 Conflict resolution into Cleaned (Delta MERGE)

⚖️ Core Decision Matrix

ApproachTransform runsWhat lands in the targetFitsUnit example
ETLin a staging step before loadalready cleaned, conformed, aggregated dataa warehouse engine that should hold only curated tablesOracle Model 3: Temp DB ➔ PL/SQL ➔ star
ELTinside the target, after loadraw data first, transformed in placea platform with elastic compute that also keeps raw data (lake/lakehouse)Raw ➔ Cleaned ➔ Facts & Dims on Spark/Delta

When It Flips: when the target has cheap storage and scalable compute, landing raw first (ELT) keeps the untouched copy and lets the platform do the heavy transform; when the target should only ever see curated data, transform first (ETL).

📊 Exam Execution Trace & Applied Exercises

Manual Execution Trace — the MERGE above

raw.student_raw for S7 (source_priority: = most trusted); cleaned.student holds S7 at updated_at 09:00.

StepRow(s) consideredRule firedResult
1(10:05, prio 2) · (10:05, prio 1) · (09:30, prio 1)ORDER BY updated_at DESCthe two 10:05 rows tie on top
2(10:05, prio 2) · (10:05, prio 1)then source_priority ascending(10:05, prio 1) gets ROW_NUMBER
3u = (10:05, prio 1) vs s = 09:00MATCHED AND u.updated_at > s.updated_atUPDATE SET * ➔ cleaned row now 10:05
4a new key S9 in uNOT MATCHEDINSERT *

Final Extracted Output: one row per student, holding the latest, most-trusted version; a stale raw row (older than the cleaned copy) never overwrites.

🧠 Active Recall