Design an ETL Pipeline
Understanding the Problem
🔄 What is an ETL pipeline? ETL stands for extract, transform, load: copy data out of the systems where it's created (production databases, SaaS tools like Salesforce and Stripe, files from partners), reshape it, and load it somewhere it can be analyzed, usually a data warehouse like Snowflake, BigQuery or Redshift. A modern ETL platform runs thousands of these pipelines on schedules or continuously. Fivetran, Airbyte, AWS Glue and in-house platforms built on Airflow and Spark are all examples.
This question shows up in a few forms: "design a batch processing pipeline," "replicate an Oracle database into the warehouse with CDC," "sync data between SaaS services," or "process large file uploads and show the user progress." They're the same platform with different connectors: a database connector (batch or CDC), an API connector and a file connector, all feeding the same staging, loading and bookkeeping machinery. We'll build the platform and treat each variant as a requirement.
Functional Requirements
Core Requirements
- Users should be able to define pipelines: a source, a destination, a schedule (or continuous), and optional transformations.
- The system should run batch pipelines on schedule, extracting full or incremental data from databases and SaaS APIs and loading it into the warehouse.
- The system should replicate changes from operational databases such as Oracle into the warehouse continuously, with a few minutes of delay.
- Users should be able to upload large files (CSV or JSON, up to several GB), see progress while they're processed, and get a report of rows that failed.
Below the line (out of scope)
- The warehouse itself, and BI dashboards on top of it.
- Complex transformation authoring (we'll assume SQL models run in the warehouse, like dbt).
- Real-time streaming analytics; see the analytics platform.
Non-Functional Requirements
Ask about scale and sources. We'll assume 5,000 pipelines moving about 20 TB a day in total. The largest source is an Oracle database of 10 TB with up to 10,000 row changes per second at peak.
Core Requirements
- The destination should end up with exactly the source's data: no missing rows and no duplicates, even when runs fail and are retried.
- CDC pipelines should deliver changes within about 5 minutes; batch pipelines should meet their schedules (hourly or daily).
- Extraction must not degrade production databases or exceed SaaS API rate limits.
- Any run should be safely re-runnable, and any time range should be backfillable without manual cleanup.
- Schema changes in a source should be handled or flagged, never silently break or corrupt the destination.
Below the line (out of scope)
- Sub-second replication.
- Cross-row transactional consistency in the warehouse (each table is consistent, but two tables may be a few seconds apart).
The math that matters. 20 TB a day is about 230 MB/s on average, which a pool of workers handles easily; volume isn't the problem. The interesting number is the Oracle database. A full copy of 10 TB at a sustained 200 MB/s takes about 14 hours, too long for a nightly window and a heavy load on a production database the whole time. Meanwhile, 10,000 changes per second at roughly 1 KB each is only about 10 MB/s, or under a terabyte a day. The changes are a tiny fraction of the table. So the design should copy the table once and then move only the changes.
Interviewers aren't looking for exotic technology here. They want to see that you think about correctness under failure: what happens when a run dies halfway, when a row is updated while you're reading it, or when a column is dropped. Make every step re-runnable and you've answered most of the follow-ups.