Overview
A data lake is a central repository that stores raw data of any shape (structured tables, JSON events, logs, images) cheaply in object storage such as Amazon S3, in open file formats like Parquet. Unlike a data warehouse, which requires a schema before loading (schema-on-write), a data lake stores data first and applies structure when it is read (schema-on-read).
Modern lakes are organized in layers, often called bronze (raw), silver (cleaned and joined), and gold (business-ready aggregates). A catalog tracks tables and schemas, and query engines (Spark, Athena, Trino) read the files directly. Open table formats such as Apache Iceberg and Delta Lake add ACID transactions, schema evolution, and time travel, turning the lake into a lakehouse.
Rivers (sources) flow into a reservoir (raw zone). Water is filtered (silver) and then bottled for specific uses (gold). You can always go back to the reservoir to treat water differently.
When to use it
- Storing large volumes of diverse data for analytics and machine learning.
- Keeping raw history cheaply for reprocessing.
- Decoupling storage from compute so multiple engines share the same data.
- Building analytics on top of event streams and CDC.
Where it shows up in interviews
Recognize it when: collect everything, analyze later.
- Design a clickstream analytics platform
- Design a data platform for ML training
Recognize it when: continuous events into analytics storage.
- Design an ad click aggregation system
- Design IoT telemetry storage
Where it is used in real software
Built its data platform on S3 and created Apache Iceberg to manage petabyte-scale tables with reliable schema evolution.
Delta Lake on object storage with bronze/silver/gold medallion layers is a common enterprise pattern.
S3 + Glue Data Catalog + Athena lets teams query files with SQL without managing servers.
Key terms
- Schema-on-read
- Structure applied when querying, not when loading.
- Parquet
- Columnar file format with compression, ideal for analytics.
- Partitioning
- Organizing files by keys such as date so queries skip irrelevant data.
- Table format (Iceberg, Delta)
- Metadata layer adding ACID transactions and schema evolution to files.
- Medallion architecture
- Bronze (raw), silver (clean), gold (aggregated) layers.
How it works, step by step
- 1Ingest raw data
Batch loads, CDC from databases, and streams (Kafka, Kinesis) land in the bronze zone.
- 2Catalog it
Register tables, schemas, and partitions in a catalog (Glue, Hive Metastore, Unity Catalog).
- 3Clean and conform
Deduplicate, validate, and join into silver tables.
- 4Aggregate for consumers
Build gold tables for dashboards, reporting, and features.
- 5Query and govern
SQL engines and ML jobs read the tables; access control, lineage, and retention policies apply.
STEP 1App events, database CDC, and logs land as raw Parquet or JSON in S3, partitioned by date.
Data lake vs data warehouse vs lakehouse
Key differences
| Aspect | Data lake | Data warehouse | Lakehouse |
|---|---|---|---|
| Data types | Any (raw) | Structured | Any |
| Schema | On read | On write | On write with evolution |
| Storage cost | Low (object storage) | Higher | Low |
| Transactions | Not by default | Yes | Yes (Iceberg/Delta) |
| Typical users | Data engineers and ML | Analysts and BI | Both |
NOWAspect: Data types | Data lake: Any (raw) | Data warehouse: Structured | Lakehouse: Any
Lakehouses combine cheap open storage with warehouse-like reliability.
Implementation
-- Silver table in Iceberg, partitioned by dayCREATE TABLE silver.page_views ( event_id STRING, user_id STRING, url STRING, country STRING, event_time TIMESTAMP)PARTITIONED BY (days(event_time))TBLPROPERTIES ('table_type' = 'ICEBERG'); -- Idempotent upsert from raw events (deduplicate by event_id)MERGE INTO silver.page_views tUSING (SELECT DISTINCT event_id, user_id, url, country, event_time FROM bronze.raw_events WHERE dt = '2026-09-26') sON t.event_id = s.event_idWHEN NOT MATCHED THEN INSERT *; -- Gold aggregate; partition pruning reads only one day of filesINSERT OVERWRITE gold.daily_viewsSELECT date(event_time) AS day, country, count(*) AS views, approx_count_distinct(user_id) AS uniquesFROM silver.page_viewsWHERE event_time >= TIMESTAMP '2026-09-26' AND event_time < TIMESTAMP '2026-09-27'GROUP BY 1, 2;Complexity and performance
Object storage standard tier.
Partitioning and columnar formats reduce it dramatically.
Trade-offs
Storing everything is cheap and flexible, but without catalogs, quality checks, and ownership, lakes turn into unusable swamps.
Open formats avoid lock-in and share data across engines; managed warehouses (Snowflake, BigQuery) offer simpler performance tuning and governance.
Variants and related techniques
Iceberg, Delta Lake, or Hudi tables with ACID and time travel.
Domain teams own and publish their data products on shared infrastructure.
Common mistakes
- Millions of tiny files.
Fix: Batch writes and run compaction jobs into larger Parquet files (128 MB-1 GB).
- No partitioning or poor partition keys.
Fix: Partition by commonly filtered columns (date), avoiding high-cardinality keys.
- Personal data copied everywhere.
Fix: Classify, mask, and apply retention and access policies from bronze onward.
Interview questions
Data lake vs data warehouse?
A data lake stores raw data of any format cheaply in object storage with schema-on-read, great for flexibility and ML. A warehouse stores curated, structured data with schema-on-write and strong SQL performance for BI. Lakehouses add warehouse features like ACID and schema enforcement to lake storage.
How would you design an analytics pipeline for clickstream data?
Stream events into Kafka or Kinesis, land raw data in S3 partitioned by date (bronze), run streaming or batch jobs to deduplicate and clean into Iceberg tables (silver), build aggregates (gold), and query with Athena, Trino, or Spark, with a catalog and access controls.
Practice problems
| Problem | Difficulty | What it trains |
|---|---|---|
| Design bronze/silver/gold tables for an e-commerce site | Medium | Layering and partitioning. |
| Fix a slow lake query caused by small files | Medium | Compaction and pruning. |