◐ ai-teacher

🧱 Foundations · Chapter 7

Data lake vs warehouse vs lakehouse

A warehouse is a restaurant: fast, clean, expensive, you eat what's on the menu. A lake is a wholesale market: cheap, anything goes, bring your own knives. The lakehouse is the attempt to get restaurant service at market prices.

Study this lesson free in the app →

The basics

A data warehouse is a database built for analytics: you load cleaned, typed tables into it and query them with SQL (Snowflake, BigQuery, Redshift). A data lake is cheap object storage (S3, GCS, ADLS) holding files in any format, which many engines can read. A lakehouse puts an open table format (Delta Lake, Apache Iceberg, Apache Hudi) on top of the lake so those files behave like warehouse tables — transactions, updates, schema enforcement.

The problem it solves: companies need two things that used to conflict — cheap storage for everything (raw events, logs, images, ML data) and reliable, fast SQL tables for reporting. For years that meant keeping data twice: in the lake and copied into the warehouse.

The mental model: separate where bytes live from who manages them.

Words you must know 5

Schema-on-write
validate structure when loading (warehouse)
Schema-on-read
interpret structure when querying (lake)
Object storage
S3-style storage: cheap, durable, files can't be edited in place
ACID
all-or-nothing, consistent writes
Medallion
bronze (raw) → silver (clean) → gold (business-ready) layers

Explained

Meghalaya Cabs stores 40 TB of GPS pings, ride events and support-call audio. Putting all of it in Snowflake would cost a fortune. Putting all of it in S3 means the finance team can't run a reliable UPDATE when a refund lands.

Where data lives and how it's managed used to be one decision. The lakehouse made it two.

The godown and the showroom

A furniture business has a godown on the edge of town: cheap rent, huge, everything goes in — raw timber, half-built chairs, returns. Finding a specific chair takes a man with a torch and an hour. That's the lake.

It also has a showroom in Police Bazar: expensive per square foot, only finished, labelled pieces, and a customer finds what they want in a minute. That's the warehouse.

For years every chair was built in the godown and then trucked to the showroom. The lakehouse idea: put shelving, labels and a stock register inside the godown, so customers can shop there directly — and stop paying for the truck.

Side by side

                 WAREHOUSE        LAKE              LAKEHOUSE
─────────────────────────────────────────────────────────────────
storage          vendor-managed   object storage    object storage
format           proprietary*     any files         Parquet + table
                                                    format metadata
schema           on write         on read           enforced on write
ACID / UPDATE    yes              no                yes
time travel      yes (limited)    no                yes (snapshots)
engines          the vendor's     any               many (Spark, Trino,
                                                    Flink, warehouses)
unstructured     poor             yes               yes (alongside)
cost / TB        high             lowest            low
ops effort       low              high              medium

Before and after the lakehouse

The two-tier design keeps two copies, two permission systems and a sync job that can drift. The lakehouse keeps one copy on open formats that many engines read.

Medallion layers at Meghalaya Cabs

 BRONZE (raw, append-only)           as it arrived
  s3://mc-lake/bronze/ride_events/   JSON from Kafka, never edited
        │  parse, dedupe, type, conform
        ▼
 SILVER (clean, conformed)          one row per real thing
  silver.rides, silver.drivers       Delta/Iceberg, MERGE-able
        │  join, aggregate, apply business rules
        ▼
 GOLD (business-ready)              what dashboards read
  gold.daily_city_revenue            ₹ by city by day
  gold.driver_payouts

Bronze is your insurance policy: if silver logic was wrong, rebuild from bronze.

The GDPR-style deletion request

A rider asks Meghalaya Cabs to delete their data (India's DPDP Act gives them that right).

Plain lake: their rides are scattered across 9,000 Parquet files. You must find every file containing them, rewrite each without those rows, and swap files while queries are running — readers may see half-rewritten data. Usually a weekend project.

Warehouse: DELETE FROM rides WHERE rider_id = 'r_8812'. Done.

Lakehouse: the same DELETE statement. The table format rewrites the affected files (or writes delete files), then commits a new snapshot atomically — readers see before or after, never in between. (Old snapshots still hold the rows until you expire/vacuum them — part of the job.)

At scale: choosing honestly

Pick a warehouse first if you're a small team doing mostly SQL analytics on structured data. Snowflake/BigQuery need near-zero ops and the bill at small scale is less than one engineer.

Move toward a lakehouse when: data is huge (hundreds of TB+), much of it is semi-/unstructured, ML teams need raw files in Python/Spark, or several engines must share one copy without vendor lock-in.

What most companies actually run: a lake for raw/bronze plus either a warehouse or lakehouse tables for silver/gold. With Iceberg support in Snowflake and BigQuery, "lakehouse vs warehouse" is increasingly which engine queries the same open tables.

Senior point: the costs move. A lakehouse lowers storage and licence bills but you now own compaction, snapshot expiry, catalog and access control.

Gotchas

Words to know

Data warehouseA managed analytical database with schema-on-write and SQL over typed tables.
Data lakeFiles of any format on cheap object storage, readable by many engines.
LakehouseA lake whose files are managed by an open table format, giving warehouse-like guarantees.
Schema-on-writeStructure is validated when data is loaded.
Schema-on-readStructure is applied by each reader when data is queried.
Medallion architectureLayering data as bronze (raw), silver (cleaned) and gold (business-ready).
Data swampA lake with no catalog, ownership or quality controls, so nobody trusts it.

In two minutes

Test yourself

1. What turns a plain data lake into a lakehouse?

  1. Moving the files into Snowflake
  2. Converting CSV to JSON
  3. An open table format (Delta, Iceberg, Hudi) managing the files with transactional metadata
  4. Adding more S3 buckets
Show the answer

An open table format (Delta, Iceberg, Hudi) managing the files with transactional metadata — The storage stays the same object store. The table format's metadata layer adds atomic commits, schema enforcement and snapshots.

2. 'Schema-on-read' means…

  1. Each reader applies structure at query time; nothing validates it on load
  2. The schema is stored in the reader's memory
  3. The schema is enforced on every insert
  4. There is no schema anywhere
Show the answer

Each reader applies structure at query time; nothing validates it on load — Data lands as-is and readers interpret it. The trap answer 'no schema' is wrong — every reader has one, they just may disagree.

3. Which is NOT a typical strength of a plain data lake?

  1. Low cost per TB
  2. Storing unstructured data like audio
  3. Being readable by many engines
  4. Atomic UPDATE and DELETE of individual rows
Show the answer

Atomic UPDATE and DELETE of individual rows — Plain files on object storage have no transaction log, so row-level updates mean rewriting files by hand with no isolation.

4. A 4-person analytics team at a startup, all SQL, structured data, 2 TB. Best starting point?

  1. A managed cloud warehouse like Snowflake or BigQuery
  2. Self-managed Spark + Iceberg lakehouse
  3. Plain S3 lake with Athena only
  4. An on-prem Hadoop cluster
Show the answer

A managed cloud warehouse like Snowflake or BigQuery — At this size the warehouse bill is small and ops effort is near zero. A lakehouse's maintenance burden doesn't pay off yet.

5. Meghalaya Cabs' lake and warehouse disagree on yesterday's ride count by 33. The architecture most likely responsible is…

  1. A lakehouse with one copy
  2. A two-tier design copying lake data into the warehouse with a sync job
  3. A single warehouse
  4. Medallion layers
Show the answer

A two-tier design copying lake data into the warehouse with a sync job — Two copies plus a sync job means two chances to drift (late files, failed loads, different dedup). One-copy designs remove that class of bug.

6. Why keep a bronze layer that's never edited?

  1. Bronze is faster to query than gold
  2. Regulators require JSON
  3. It lets you rebuild silver and gold from raw when logic was wrong
  4. It replaces backups of the source database
Show the answer

It lets you rebuild silver and gold from raw when logic was wrong — Raw, append-only data is your replay source. If a parsing bug corrupted silver, you re-derive it from bronze.

There are 9 questions, 3 puzzles and 5 recall cards for this lesson in the app — the recall cards come back on later days, just before you would forget.

Learn it so it stays. Read it, test yourself, then recall it on two different days. The app schedules that for you, free.

Start this lesson →