Module 06 · Lesson 2 of 11Free
ETL vs ELT: where the transformation happens
- Level
- Beginner
- Reading time
- 13 min
When you finish this page you can
- Tell ETL from ELT by where the transformation runs and what the warehouse receives.
- Explain why warehouses that separate storage from compute made ELT the usual default.
- Estimate what loading raw data costs in storage and warehouse compute for a given volume.
- Decide what still has to change before the load, such as personal data, and keep that step small.
Builds on 2 lessons
Start with Module 01, lesson 213 minChapters
Show transcript
0:00 Kartly, our example online shop in India, now takes about 500,000 orders a day. Meera is a data engineer. Her job is to move those orders into Snowflake. That’s the warehouse, the big database where reports are built. Daniel leads finance reporting. He reads revenue from it every morning, and it has to be ready by seven. The old nightly script can’t keep up. So Meera has two plans. Plan A: a separate set of servers reads the orders, cleans them, applies Daniel’s revenue rules, and sends only finished tables to the warehouse. Plan B: copy the orders into the warehouse almost as they are, then let SQL inside the warehouse build the finished tables. Plan A is called ETL. Plan B is called ELT. Which one should she pick?
0:40 Both plans do the same three steps. Extract: read rows from the source. Transform: clean them, join them and apply the business rules. Load: put them where people query. ETL is extract, transform, load. ELT swaps the last two. In ETL, the transform runs on its own engine, between the source and the warehouse. The warehouse only ever sees finished tables. In ELT, the raw rows go in first. Then the transform runs inside the warehouse, written as SQL. So the question is: does the transformation run before the data reaches the warehouse, or inside it? Here is why it matters. Say Plan A has a cleaning bug that drops every order with a blank city. Daniel spots it a week later. Where are those orders? Only in the source database. They never reached the warehouse, so Meera has to extract that whole week again. Under Plan B they sit in the raw table. She fixes the SQL and rebuilds. That’s all. Think of cooking. ETL is washing and chopping everything at the market, and carrying home only the finished meal. ELT is carrying everything home as it is, and doing the cooking in your own kitchen.
1:43 ETL came first for a good reason. Long ago, a warehouse was one machine. Storage and computing power came as one package. Every raw row used up disk. Every transform used time that reports needed. So teams cleaned the data outside, and loaded only what reports needed. Cloud warehouses split those two costs. Snowflake keeps table data in cloud storage. Queries run on virtual warehouses: groups of servers you can start, stop and size on their own. One doesn’t slow another. So for Meera, raw rows cost only storage. And her transforms get a virtual warehouse of their own, so they never slow Daniel’s reports. The language changed too. In ELT, the transform is SQL, which Daniel’s analysts already read. A tool called dbt turns SQL select statements into tables. So changing a rule becomes a reviewed SQL change, not an edit to another engine’s code.
2:35 ELT moves the work into the warehouse, so the warehouse pays for it. How much? For orders, very little. The hourly loads keep every version of an order. That’s about 300 MB a day. A year of that on S3 costs about three dollars a month. The nightly transform is small too. Clicks are different. Kartly records about 200 million click events a day. That’s roughly 60 GB. Loading all of it, just to shrink it to a small daily summary, means heavy, repeated work in the warehouse. For clicks, the answer could change. Many engineers believe ETL throws raw data away and ELT keeps it. That’s only half right. Keeping every raw load is good practice either way. An ETL pipeline can do it too, by writing its extract to storage first. Kartly keeps its raw orders in S3 whichever plan wins. The real difference is narrower: which engine runs the rules, and do the raw rows sit in the warehouse next to the results?
3:25 ELT has a weak spot. Each order also carries a delivery phone number and street address. Plan B copies them into the raw table unchanged. To debug numbers, 40 analysts get read access to it. Now all 40 can read every customer’s phone and address. And when a customer asks Kartly to delete their data, Meera has to hunt through every file and table. The fix is a small step before the load. Drop what no report needs, like the street address. Replace what reports still join on, like the phone number, with a token. The same phone number always gets the same token, so joins still work. Business rules still run after the load. People call this EtLT: a small t before the load, and the big T after. Why a token, and not a plain hash? A hash is a one-way scramble of a value. A phone number has only ten digits, so there are at most ten billion of them. Anyone can hash them all and match the results. An HMAC mixes in a secret key. Without the key, nobody can build that lookup table. The key lives in a secrets manager, not in the data or the code.
4:22 So which plan for Kartly’s orders? Option one is ETL with a set of servers. Snowflake gets only finished tables, but every rule change means rerunning the code over past data, and Meera pays for servers all year to process about 300 MB a day. Option two is ELT with nothing before the load. Rule changes are easy, but every phone number and address lands raw. Option three is ELT with a light step before the load. Option three wins. The light step drops the address and swaps the phone for a token. Then it loads the raw table. dbt builds the finished tables on a transform warehouse of its own. Reports read only those finished tables. The orders are small and their rules change often, so the rules belong where changing them is cheap. Privacy is the one fix that can’t wait. Two mistakes to avoid. First: thinking ELT means nothing happens before the load. Personal data and file-format changes get fixed first. Second: letting the light step grow. A quick currency conversion there is really a business rule. Now a rule lives in two places, and any rows it filtered out never reach raw to be rebuilt.
5:22 Let’s recap. One: run business rules in the warehouse, that’s ELT, when the data fits and the rules change often. Run them before it, that’s ETL, when raw data dwarfs the result or the work isn’t SQL. Two: both do the same three steps. Only the place of the transform differs. Three: separating storage from compute made raw rows cheap to keep. Four: fix personal data before the load, with a small step that never grows into business rules. Five: reports read only the finished tables. Plan B still has to decide how much to extract each hour. Next, we’ll compare three ways to do that. See you in Ingestion patterns.
Two plans for 500,000 orders a day
It’s Monday, 8 November 2027, a year after the last module. , an online store in India, now takes about 500,000 orders a day. Meera, a data engineer, moves those orders from the orders database into Snowflake, Kartly’s warehouse. Daniel, who leads finance reporting, reads revenue from it by 07:00 every morning.
The old nightly job, one Python script on one 8 GB server, can’t keep up any more. Meera has two plans for where the cleaning and Daniel’s revenue rules should run:
- Plan A: a processing cluster reads the orders, cleans them, applies the rules and writes only finished tables into Snowflake.
- Plan B: a load job copies the orders into Snowflake almost as they are. SQL inside Snowflake then builds the finished tables.
Plan A is called and Plan B is called . Both do the same three steps in a different order. This lesson answers one question: should the transformation run before the data reaches the warehouse, or inside it?
Same three steps, two orders
Every extracts rows from a source, transforms them (cleans, joins and applies business rules) and loads them into the store people query. Data pipelines covers the steps themselves. Here, only their order matters.
- ETL (extract, transform, load): the transform runs on its own engine, such as Spark or a Python service, between the source and the . The warehouse receives finished tables.
- ELT (extract, load, transform): the load comes first. Raw rows land in the warehouse, and the transform runs there, as SQL.
ETL: transform, then load
ELT: load, then transform
| ETL | ELT | |
|---|---|---|
| Where the transform runs | A separate engine | The warehouse, as SQL |
| What the warehouse receives | Finished tables | Raw rows, then finished tables built from them |
| What fixing a rule needs | Rerun the engine over past data | Rerun the SQL over rows already loaded |
| What you pay for transforms | The engine’s servers | Warehouse compute time |
Under Plan A, a cleaning bug drops every order with a blank city. Daniel spots it a week later. Where are those dropped orders now?Show answer
Why ETL came first
For a long time, a warehouse was one system with its storage and compute bought together and sized years ahead. Every raw row used its disk. Every transform took processor time from the reports. So teams cleaned and summarised data outside, and loaded only what reports needed.
Cloud warehouses split those two costs. Snowflake keeps table data in cloud storage, in its own compressed columnar format 1. Queries run on : clusters of servers that run queries and can be started, stopped and sized on their own. Each one is an independent compute cluster, and one doesn’t slow down another 1. How cloud warehouses separate storage and compute covers the mechanism.
For Meera, this means two things. Raw rows cost only storage. And her transforms can run on their own virtual warehouse, so they never slow Daniel’s reports.
The transform language also changed. In ELT it’s SQL, which Daniel’s analysts already read. Tools such as turn SQL select statements over raw warehouse data into tables 2. dbt has its own module. So a rule change becomes a reviewed SQL change, not a change to a separate engine’s code.
ELT moves the work into the warehouse, so the warehouse now pays for it. How much?
What loading raw costs Kartly
Raw order rows a day
about 1.5 million changed rows × about 200 bytes = about 300 MB a day
The hourly loads keep every version of an order they see, not just 500,000 new orders. About 110 GB a year, before any compression.
Storing a year of raw orders on S3
110 GB × $0.025 per GB a month ≈ $2.75 a month
The price is S3 Standard in Mumbai, $0.025 per GB a month (first 50 TB), from AWS’s price list checked in November 2026. Parquet files would be smaller still.
Raw click events a day
200 million events × about 300 bytes = about 60 GB a day
13 months of raw clicks is about 23.4 TB, or about $585 a month before compression.
Transform compute for orders
Small warehouse: 2 credits an hour × 40 minutes ≈ 1.3 credits a night, about 40 a month
A Small warehouse uses 2 credits an hour (X-Small 1, doubling each size to 6X-Large 512). The 40-minute nightly build is an assumption.
Bytes per row and the run time are estimates for this scenario. Credits are Snowflake’s billing unit; their price depends on edition and region.
For orders, the answer is clear. A year of raw rows costs about three dollars a month to keep, and the transform is small. Daniel’s rules change several times a year, as Metrics and semantic layers showed. Each change becomes a SQL edit and a rebuild.
Clicks are the case where the answer could change. Loading 60 GB a day only to reduce it to a small daily summary makes the warehouse do heavy, repeated work. Modules 08 and 12 show the tools that transform such data before or outside the warehouse.
Keeping raw data is not what makes it ELT
Many engineers believe ETL throws raw data away and ELT keeps it. That’s only half right. The data lifecycle showed why every raw load is kept unchanged: to rebuild history when a rule changes. An ETL pipeline can do that too, by writing its extract to object storage first. Kartly lands its orders as Parquet in S3 (kartly-raw-prod/orders/event_date=2027-11-08/) whichever plan wins.
The real difference is narrower: which engine runs the rules, in which language, and whether the raw rows sit in the warehouse next to the results.
Where ELT breaks: personal data lands raw
In this lesson’s scenario, each order row also carries the delivery phone number and street address.
Phone numbers in a table 40 people can read
- The load copies orders unchanged into
RAW.ORDERSin Snowflake. - To debug numbers, 40 analysts get read access to the
RAWschema (an example figure). - Every customer’s phone number and street address is now readable by all 40. Copies sit in every S3 file and every table built from them.
- A customer asks Kartly to delete their data under India’s DPDP Act or the EU’s GDPR. Meera now has to find that person in S3 files, raw tables and everything built from them.
The fix is a small transform before the load. It drops what no report needs, such as the street address. It replaces what reports still join on, such as the phone number, with a token. Business rules still run after the load. People sometimes write this pattern as EtLT: a small “t” before the load, the big “T” after. Personal data covers masking in depth.
Phone: as typed → as loaded into RAW
| delivery_phone | phone_token |
|---|---|
| +91 98765 00001 | 574059a9f78dfa83 |
| 098765 00001 | 574059a9f78dfa83 |
Same last ten digits, same token, so joins still work.
Address: dropped before the load
| delivery_address |
|---|
| Flat 4, Example Road |
| 12 Sample Lane |
No report needs it, so it never reaches S3 or RAW.
A plain of a phone number isn’t enough. India has at most 10 billion ten-digit numbers, so anyone can hash them all and match the results. An mixes a secret key into the hash 3. Without the key, nobody can build that lookup table. The key lives in a secrets manager, not in the data or the code.
import csv
import hashlib
import hmac
import os
import sys
KEY = os.environ["KARTLY_HASH_KEY"].encode() # from the secrets manager
KEEP = ["order_id", "customer_id", "status", "amount_inr", "updated_at", "delivery_city"]
def phone_token(phone: str) -> str:
# Same last ten digits in, same token out, however the number was typed.
digits = "".join(ch for ch in phone if ch.isdigit())[-10:]
return hmac.new(KEY, digits.encode(), hashlib.sha256).hexdigest()[:16]
def light_step(row: dict[str, str]) -> dict[str, str]:
out = {col: row[col] for col in KEEP} # delivery_address is dropped here
out["phone_token"] = phone_token(row["delivery_phone"])
return out
reader = csv.DictReader(sys.stdin)
writer = csv.DictWriter(sys.stdout, fieldnames=KEEP + ["phone_token"])
writer.writeheader()
for row in reader:
writer.writerow(light_step(row))Try it yourself
Save the code as light_step.py. It needs only Python 3.12 and its standard library. Set a practice key, make two made-up orders, then run it:
export KARTLY_HASH_KEY=practice-only-key # a real key comes from the secrets manager
printf 'order_id,customer_id,status,amount_inr,updated_at,delivery_city,delivery_phone,delivery_address\n5001,501,placed,1200.00,2027-11-08 09:10:00,Pune,+91 98765 00001,"Flat 4, Example Road"\n5002,501,placed,800.00,2027-11-08 09:40:00,Pune,098765 00001,"12 Sample Lane"\n' > orders.csv
python light_step.py < orders.csvorder_id,customer_id,status,amount_inr,updated_at,delivery_city,phone_token
5001,501,placed,1200.00,2027-11-08 09:10:00,Pune,574059a9f78dfa83
5002,501,placed,800.00,2027-11-08 09:40:00,Pune,574059a9f78dfa83Look for two things: no address column, and the same token on both rows. Run it again with a new key, and the tokens change.
Other places ELT goes wrong
- Reports read raw tables. Two analysts query
RAW.ORDERSwith their own cancelled-order rule and get two revenues. Reports should read only theANALYTICStables. - Full rebuilds grow with history. Rebuilding every order every night costs more credits each month. Rebuilding only recent days, which dbt calls incremental models, is covered in Materializations.
- Some work isn’t SQL. Reading PDFs, resizing images or computing embeddings runs outside the warehouse. Data pipelines for AI covers that path.
Choosing for Kartly’s orders
Where should the transformations for Kartly’s orders run at stage 3?
ETL: a processing cluster cleans the orders and applies every rule before the load.
Snowflake holds only finished tables, and personal data never reaches it. But each rule change means editing and rerunning the cluster’s code over past data. Meera also runs a cluster all year to process about 300 MB a day.
ELT with nothing before the load: copy every column into RAW unchanged.
Rule changes are SQL edits and rebuilds, and storage costs about three dollars a month. But every customer’s phone number and address lands in S3 and in RAW, readable by everyone with raw access.
ELT with a light step before the load: privacy fixes before, business rules after.
The extract job drops the address and turns the phone into a token, then writes Parquet to S3 and loads RAW. dbt builds ANALYTICS from RAW on a transform warehouse of its own. Reports read only ANALYTICS.
Why this choice
The orders are small and their rules change often, so the rules belong where changing them is cheap: in reviewed SQL over rows already loaded. Personal data is the one thing that can’t wait until after the load. Once it lands, every copy has to be found and deleted later.
The light step stays small on purpose. It handles only what must never land: privacy fixes and file format. Once a business rule moves into it, Kartly has two places to change a rule, and the ETL problem is back.
Meera would revisit this for a source where raw data dwarfs the result, such as clicks. She would also revisit it if the transform warehouse came to cost more than running a cluster, or if a transform can’t be written in SQL.
Common mistakes
Personal data, broken encodings and file format changes are fixed before the load. ELT moves the business rules into the warehouse, not every change.
A “quick” currency conversion or status filter added before the load is a business rule. Now a rule lives in two places, and rows it filtered out never reach RAW to be rebuilt.
Where this shows up
- Design: ingesting orders from five sources: five sources land raw first, then one set of models makes them comparable.
- Design: syncing a production database to analytics: change records land raw, and SQL merges them into current tables.
- Design: a dbt project for sales reporting: the “T” of ELT, organised for a whole team.
Plan B still has to decide how much to extract each hour: the whole orders table, only changed rows, or only new ones. Ingestion patterns compares the three.
Check your understanding
Daniel asks for revenue without delivery fees for every month of 2027. With Kartly’s ELT setup, what does Meera rerun, and does she touch the orders database?Show answer
A teammate suggests tokenising phone numbers in the first dbt model instead of before the load. Why is that too late?Show answer
Why does the light step use an HMAC with a secret key instead of a plain SHA-256 hash of the phone number?Show answer
A year later, the nightly dbt run takes 3 hours instead of 40 minutes. Should Kartly move its orders to ETL?Show answer
Summary
- Run business rules inside the warehouse (ELT) when the data fits it and the rules change often; run them before it (ETL) when raw data dwarfs the result or the work isn’t SQL.
- ETL and ELT do the same three steps. The difference is where the transform runs and what the warehouse receives.
- Warehouses that separate storage from compute made raw rows cheap to keep, and gave transforms compute that doesn’t slow reports.
- Keeping raw data isn’t unique to ELT; landing raw files in object storage helps either way.
- Fix personal data before the load, with a small step that never grows into business rules. Reports read only the finished tables.
