Data Pipeline Architecture and Design Questions
End-to-end design of data pipelines: source-to-sink flow, staging layers, idempotency, backfills, and reprocessing. Covers choosing between batch and streaming stages, decoupling ingestion from transformation, and designing for evolvability. The foundational systems-design skill for a data engineering interview.
ETL versus ELT: what's actually different between them, and why has the industry been moving transformation to happen after loading rather than before?
Sample Answer
Direct answer
Extract, transform, load (ETL) runs the transformation in a separate processing layer before the data reaches its destination; extract, load, transform (ELT) loads raw data into the destination first and lets the destination's own compute run the transformation afterward. The industry has moved toward ELT because modern cloud warehouses and lakehouse query engines now have enough separately scalable compute to run heavy transformations cheaply and elastically, so paying for a dedicated pre-load transform tier stopped being necessary for most workloads.
Structured elaboration
The actual difference
| ETL | ELT | |
|---|---|---|
| Where the transform runs | A dedicated processing layer, before load | Inside the target store, after load |
| What lands in the target | Only the transformed result | Raw data first, transformed tables built on top |
| Raw data availability | Often discarded or archived separately | Always present, so a different transform later is a re-run, not a re-extraction |
| Compute cost model | A separate transform cluster to size and pay for | The target's own compute, billed by query or warehouse time |
| Governance risk | Bad data is filtered before it reaches consumers | Raw and intermediate tables must be access-controlled so nobody queries unvetted data by mistake |
Why the industry moved to ELT
Source systems are typically online transaction processing (OLTP) systems, row-oriented and optimized for many small transactional writes, and were never suited to heavy transformation either; historically, target warehouses were also expensive, fixed-capacity compute, so transformation happened BEFORE loading, in a third, dedicated place, to avoid burning scarce warehouse cycles on cleansing. Modern warehouses and lakehouse engines are built for online analytical processing (OLAP): they separate storage from compute and scale that compute elastically, which removed the "warehouse compute is scarce" assumption ETL was built around. That let teams collapse ETL's three hops (source, transform cluster, warehouse) into two (source, warehouse), with transform logic expressed in the same engine used for querying. Keeping raw data loaded, rather than transforming it away, also means a business-logic change is a re-run of a transform query, not a full re-extraction from the source, which matters whenever re-extracting is not cheap or the source has since moved on.
When ETL still wins
Regulated or sensitive data that must be masked, redacted, or filtered before it is allowed to land anywhere queryable, or a target whose compute is genuinely constrained and expensive, where every transform cycle competes with production queries, both still favor transforming before load.
Worked example
Consider an events pipeline carrying row-level personal identifiers. Extract from the source, load the raw (but access-restricted) data into the warehouse, then run an in-warehouse transform that masks identifiers and builds the analytics-facing tables; only the masked output is exposed to the broader analyst audience, while the raw restricted zone stays limited to the pipeline owner. The masking step happens in-warehouse, which is ELT's mechanics, but the RESULT is treated like ETL's controlled output: unmasked raw data never reaches the general audience. Separately, if 200 analysts each ran the same raw-to-clean transform independently instead of querying one materialized result, that would be running the identical transformation 200 times; materializing it once and letting everyone query the result is the concrete cost-control move that keeps ELT's flexibility from turning into duplicated compute spend.
Trade-offs & pitfalls
- Loading raw data into a target with weak access control and calling it ELT invites a data swamp: without governance, "raw available to everyone" becomes a compliance risk, not a convenience.
- Running the same expensive transform repeatedly ad hoc, instead of materializing it once, can quietly multiply compute spend past what a dedicated ETL cluster would have charged.
- ELT trades a controlled, single pre-load gate for warehouse-compute cost that scales with how often and how heavily transforms run; without cost guardrails (partition pruning, scheduled materialization, query review) that cost grows unchecked.
- Treating ELT as needing no transformation strategy is a common wrong turn; it still needs the same rigor ETL had (tested logic, schema contracts, lineage), just executed in a different place.
Design where records that fail parsing or validation go in this pipeline, and how you'd get them corrected and safely replayed back into the main flow later.
Sample Answer
Direct answer
Records that fail parsing or validation go to a dead-letter queue (DLQ), a separate durable holding area, tagged with the original payload, the specific error, and a stable identifier tying them back to their place in the source. Correction happens outside the main flow (automated repair for known-fixable patterns, manual remediation for the rest), and replay pushes the corrected record back through the exact same validation gate it failed under a new attempt identifier, so it either passes cleanly or fails again visibly. Nothing is ever silently patched and slipped back in.
Structured elaboration
Put the gate as early as possible. Validation belongs at the ingestion boundary, before a record reaches any join, transform, or aggregation stage. Catching a bad record before it's mixed into shared state is cheap; unwinding an aggregate it already corrupted is not.
Parsing failures and validation failures are different problems. A parsing failure (malformed structure, broken encoding) usually points at a producer bug and is rarely safe to auto-fix. A validation failure (a missing required field, a value out of range, a reference that doesn't resolve) is often fixable given a bit more context, which is why it's worth routing these two differently rather than treating every failure the same way.
What has to travel with a record into the DLQ. The raw original payload, the specific rule or field that failed, a timestamp, a stable identifier that preserves its position in the source stream, and a retry or attempt counter. Without this, remediation is guesswork.
Two correction paths, not one. A known, safe failure pattern (for example, a schema version the pipeline hasn't rolled out support for yet) can go through an automated repair-and-resubmit step with no human involved. Everything else goes to a remediation surface where a person can see the failure reason and the payload, fix or annotate it, and mark it ready to go back through.
Replay through the same gate, under a new identity. A corrected record is resubmitted through the identical validation logic it originally failed, not around it, so a bad fix still gets caught. It carries a new attempt identifier rather than overwriting the original entry, preserving an audit trail of what failed, what changed, and when it was retried.
Watch the queue itself, not just individual failures. A DLQ that only ever grows is itself a signal. The right response to a small, steady trickle (normal background noise) is different from the right response to a sudden spike (usually a systemic break, like an upstream schema change), and the pipeline needs a way to tell those apart rather than routing an ever-growing stream to a queue nobody is watching.
Worked example
Say the pipeline ingests 2,400,000 records a day, and historically 0.25 percent fail validation:
2,400,000×0.0025=6,000 records/day to the DLQSpread evenly across 24 hours, that's a baseline arrival rate of:
246,000=250 records/hourNow suppose an upstream schema change causes 8 percent of one hour's arriving records (100,000 that hour) to fail validation:
100,000×0.08=8,000 records in that single hourCompared to the 250-per-hour baseline, that's:
2508,000=32× the normal hourly rateIf the alerting rule fires whenever the DLQ arrival rate exceeds 5 times the trailing baseline, this spike (32 times baseline) triggers it clearly, which is exactly the signal that should prompt someone to check for a systemic cause, like a schema change, instead of assuming it's more of the same background trickle.
flowchart LR
A[Incoming record] --> B[Validation gate]
B -->|passes| C[Continue through pipeline]
B -->|fails| D[Dead-letter queue]
D --> E[Automated repair, known patterns]
D --> F[Manual remediation]
E --> G[Replay, new attempt id]
F --> G
G --> B
Trade-offs & pitfalls
- A DLQ with no remediation and replay loop is a write-only graveyard; it's no better than silently dropping the records, just more expensive to store.
- Reprocessing a corrected record under its original identity, instead of a new attempt identifier, erases the audit trail of "this failed once, here was the original data."
- Auto-retrying validation failures that are genuinely permanent (a business-rule violation, not a transient glitch) wastes effort on records that will fail identically every time until the rule or the data changes.
- Placing the validation gate after joins or aggregation means a bad record has already corrupted shared downstream state before anyone catches it; moving the gate earlier is nearly free, unwinding a corrupted aggregate is not.
- Treating every spike in DLQ volume as "more of the same" instead of a signal worth investigating is how a schema break goes unnoticed for hours.
What would you actually put on an observability dashboard for a data pipeline, and why do each of those signals matter?
Sample Answer
Direct answer
At minimum, a pipeline dashboard should show freshness (how old the newest data is), completeness or volume (whether the expected amount of data actually arrived), latency (how long the pipeline took, per stage and end to end), error or failure rate, and a couple of data-quality signals (like null rates or schema drift on key fields). Together these answer "is the data here, is it on time, and is it trustworthy" without anyone needing to read logs first; a job reporting "success" alone can't answer any of those three questions.
Structured elaboration
| Signal | What it measures | Why it matters |
|---|---|---|
| Freshness | Time since the newest record or partition landed, compared to when it was expected | Catches stale data reaching consumers before anyone downstream notices or complains |
| Completeness / volume | Row or file counts against a historical baseline | Catches partial or truncated loads that a "job succeeded" status alone would miss entirely |
| Latency | How long each stage, and the pipeline end to end, actually took | Surfaces slow degradation early, before it becomes an outright breach |
| Error / failure rate | Proportion of tasks or records failing | A direct pipeline-health signal, distinct from whether the data itself is correct |
| Data-quality signals | Null rates and schema drift on the columns downstream logic actually depends on | A pipeline can finish successfully and still hand consumers wrong data; this is the only category of the five that would catch that |
| Backlog / consumer lag | How far behind real time the pipeline is currently running | An early warning that shows up before freshness or latency actually breaches a threshold |
What decides what belongs here versus what belongs to a full alerting design. The dashboard's job is to let someone without deep pipeline knowledge tell, at a glance, whether the data currently on it is trustworthy. Deciding exactly which breach pages someone and which is quietly logged is a separate design question about thresholds and escalation; for an entry-level "what goes on the dashboard" answer, naming the six signals above and why each matters is the proportionate depth.
Worked example
Take a daily sales pipeline expected to finish by 02:00 UTC with a typical row count around 500,000.
- Freshness: data landed at 01:40, 20 minutes ahead of the deadline. Fine.
- Completeness: 494,200 rows landed against the 500,000 baseline, a shortfall of
which is within a normal day-to-day variance band, so it reads fine on the dashboard.
- Latency: the run took 55 minutes against a typical 40 to 50 minute range, mildly elevated, worth a glance but not alarming on its own.
- Error rate: 3 of 40 tasks needed a retry:
against a normal baseline around 2 percent, which is the one figure on this dashboard that stands out enough to warrant a closer look.
- Null rate on the revenue column: 0.02 percent, well within tolerance.
This is what "why each signal matters" looks like in practice: four of the five numbers are unremarkable, and the dashboard's job was to make the one that isn't (the error rate) visible at a glance, without anyone needing to dig through task logs first.
Trade-offs & pitfalls
- Overloading the dashboard with every metric the system can emit defeats its purpose; someone should be able to judge overall health in under a minute, not scroll through fifty panels.
- Treating job-succeeded status as sufficient is the main pitfall: a job can report success against empty or truncated input, and only the completeness and data-quality signals would catch that.
- A static, hardcoded threshold ages badly against seasonal patterns (weekday versus weekend volume, for example); comparing against a rolling historical baseline is more proportionate than picking one fixed number, without needing to design the full paging and escalation policy that decision requires elsewhere.
- Leading with infrastructure metrics (CPU or memory usage) instead of these data-centric signals answers a different question than the one most stakeholders actually have, which is whether their data is present and correct.
You're designing the DAG for a pipeline where some stages feed an executive dashboard and others feed ad-hoc, lower-priority analysis. How do you set dependencies, retries, and SLAs so the important path isn't held hostage by the less important one?
Sample Answer
Direct answer
Give the executive-dashboard path and the ad-hoc, lower-priority path separate directed acyclic graphs (DAGs), or at minimum no shared edges between them, so a failure or slow run in the low-priority branch can never block, delay retries for, or consume retry budget from the critical branch. Where both paths need the same upstream source, fan out from a single shared ingestion step into two independent downstream graphs, rather than making one branch depend on the other's completion.
Structured elaboration
Dependency structure: any task on the critical path should have zero downstream or upstream edges to a non-critical task. If both branches read the same raw table, model that as two independent consumers of one producer, not a chain. A shared DAG where the low-priority branch is simply further along the same line means a slow ad-hoc stage delays the scheduler's view of whether the run is complete, even when the actual dashboard output was never late.
Retries: give the critical path a short retry interval with a small number of aggressive retries, so a transient failure resolves fast. The ad-hoc path can use longer backoff, more retries, or no automatic retry at all (a rerun-on-demand model), since it is acceptable for it to take longer or wait for manual attention.
Service-level agreements (SLAs): define the SLA only against the critical path's own tasks. If the SLA calculation looks at when the whole DAG finished instead of when the tasks feeding the dashboard finished, a slow ad-hoc branch can falsely trip an SLA alert for a dashboard that was actually delivered on time.
Resource contention: the two paths can compete for the same execution resources (worker slots, warehouse compute) even when they are structurally independent DAGs. Give the critical path its own resource pool or a higher-priority queue slot so it is never queued behind ad-hoc work.
Worked example
A cohort or retention dashboard needs a daily active-user rollup ready by a fixed review time, while the same raw event stream also feeds a separate ad-hoc analysis DAG (funnel breakdowns, one-off segment cuts) with no fixed deadline. The structure: one shared ingestion task lands raw events; two independent downstream DAGs both consume it. The cohort/retention DAG (aggregate, compute the retention window, publish to the dashboard) carries a tight SLA and fast retries. The ad-hoc DAG (exploratory transforms) has its own scheduling and no SLA. If the ad-hoc DAG's exploratory job hangs because of a runaway query, the cohort/retention DAG is unaffected, because it was never downstream of it, only downstream of the shared ingestion task, which had already completed. Because the cohort DAG's own compute only processes the day's new partition rather than the full history, its SLA can reasonably be set tight precisely because it has been structurally decoupled from anything the ad-hoc path might do; a shared-DAG design would force that same SLA to account for the ad-hoc branch's unpredictable runtime too.
flowchart LR
ingest["shared ingestion"] --> critical["critical: retention rollup"]
ingest --> adhoc["ad-hoc: exploratory transforms"]
critical --> dashboard["executive dashboard"]
adhoc --> analysis["ad-hoc analysis output"]
Trade-offs & pitfalls
Fully separate DAGs mean the shared ingestion logic is maintained once but consumed twice, which is fine, but if the two teams then diverge and each patches its own copy of ingestion, the coupling problem reappears in a different shape; ingestion should stay single-owned. Separate resource pools or queues cost real reserved infrastructure that can sit idle when the critical path is not running, that is the price of guaranteeing it is never queued behind ad-hoc work. The most common wrong turn is assuming task-level retry configuration alone solves this: if the DAG structure itself couples the two paths through a shared edge, no retry policy or priority setting fixes the fact that the scheduler still sees one graph.
A pipeline produces several kinds of metrics: some feed financial reporting, others feed an approximate usage dashboard. Would you engineer exactly-once delivery everywhere, or only for some of these outputs? How do you decide, and what does it cost you where you don't?
Sample Answer
Direct answer
No: exactly-once delivery should be reserved for outputs where a duplicated or dropped event has real cost, financial reporting, billing, anything reconciled against an external source of truth, and skipped for outputs whose entire premise is being approximate, like a usage dashboard. The mechanics needed to guarantee exactly-once, idempotent or transactional sinks, checkpointed state, coordinated commits, cost throughput, latency, and operational complexity that buy nothing for a metric nobody is reconciling row by row.
Structured elaboration
The decision criterion. Ask whether the output is reconciled against something external, money, a contractual commitment, a compliance obligation. If yes, it needs exactly-once, or more precisely, at-least-once delivery paired with an idempotent sink, since true exactly-once delivery across a network doesn't really exist; what's achievable is at-least-once delivery combined with processing that behaves as if it were exactly-once. If the output is inherently approximate, or its own consumers already tolerate noise (a live "users active now" counter), at-least-once, or even best-effort delivery that drops under backpressure, is enough.
What exactly-once costs where you pay for it. Stateful checkpointing overhead, transactional or two-phase-commit sinks, and coordination between the stream processor's state and the sink's commit all add latency and reduce the maximum achievable throughput compared with a simpler at-least-once path.
What skipping it saves where you don't pay for it. Simpler at-least-once consumers, higher achievable throughput per unit of compute, and less operational surface, no transactional sink to keep healthy, because a slightly wrong dashboard number self-corrects on the next refresh and nobody downstream audits it row by row.
The cost of skipping it, made concrete. A duplicate or dropped event produces a bounded, usually small, percentage error in the approximate metric. That error has to be genuinely tolerable to the actual consumer, a rounding-scale display number, not a per-transaction financial line, for the trade to be sound. If the "approximate" dashboard has quietly become an input to a real financial decision, the trade was wrong regardless of how it was originally designed.
Ingestion technology selection. Which message bus is chosen constrains which guarantee is cheap to get, and interacts directly with each path's latency and ordering requirements. A bus with transactional producers and consumers and log compaction makes exactly-once-equivalent delivery straightforward for the financial path. A lighter at-least-once bus, or even a loss-tolerant, fire-and-forget transport for extremely high-volume telemetry, is the right, cheaper choice for the approximate path. Choosing one bus for both paths means either over-paying for guarantees the dashboard never needed, or under-provisioning the ordering and durability the financial path actually requires.
Worked example
Two output streams: financial (order revenue, about 50,000 events/day) and a usage dashboard (page-view pings, about 500,000,000 events/day). The financial path applies an idempotent-sink pattern keyed on order identifier; at 50,000 events/day the per-event bookkeeping overhead is cheap in absolute terms regardless of its per-event cost, because the volume is tiny.
Applying that same per-event dedupe pattern to the dashboard path would mean:
50,000500,000,000=10,000× the per-event bookkeeping work of the financial pathfor a number that's displayed rounded to the nearest thousand anyway. If the dashboard's display tolerates being off by up to 0.1%, that tolerance is:
500,000,000×0.001=500,000 events of slack per daywhich is far larger than the duplicate or drop rate an ordinary at-least-once pipeline actually produces (network-retry duplicate rates are typically a small fraction of a percent, well inside that budget). Paying the exactly-once tax on 10,000 times the event volume would buy correctness inside a margin nobody would ever notice.
Trade-offs & pitfalls
The common wrong turn is applying one delivery-semantics decision to the whole pipeline instead of per output: either over-engineering, exactly-once everywhere, paying an unnecessary latency and throughput cost on the high-volume approximate path, or under-engineering, at-least-once everywhere, silently double-counting revenue. Another pitfall is assuming "approximate is fine" without ever checking who actually consumes that number today; dashboards have a way of quietly becoming real decision inputs over time without anyone updating their delivery guarantees to match. Finally, "exactly-once" is used loosely enough that teams sometimes assume the message bus alone provides it and skip building the idempotent processing layer that's actually doing the work, then get duplicates in production the first time a consumer restarts mid-batch.
Unlock Full Question Bank
Get access to all 46 Data Pipeline Architecture and Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.