SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
  • Batch vs Stream Processing
  • Change Data Capture (CDC)
  • MapReduce
  • ETL Pipelines
  • Data Lakes
  • Data Warehousing
  • Data Lakehouse
  • Lambda Architecture
  • Kappa Architecture
  • Streaming Engines
  • Spark and Hadoop
  • Workflow Orchestration (Airflow)
  • Parquet and Columnar File Formats
  • Data Governance and Feature Stores
Part 8: Operations and Security
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Advanced Data Topics/Big Data Processing

Data Lakes

One big, cheap place to keep raw data of every kind, to decide what to do with it later.

โฑ 12 min readBeginnerHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

A data lake is one big, cheap place where you keep raw data of every kind: logs, database exports, images, sensor readings. You decide how to use it later.

  • Data goes in as it is. Nothing is cleaned or reshaped first. This is called schema on read: the shape is applied when you read the data, not when you store it.
  • It usually lives on cheap object storage (such as Amazon S3), in open file formats like Parquet.
  • The danger is a data swamp: a lake with no catalog, no owners and no rules, where nobody can find or trust anything.

02Concept: What is it?

Before data lakes, companies loaded data into a data warehouse. That needs a plan up front: which columns, which tables, what the reports will be. Anything not in the plan was thrown away. When a new question came later, the data it needed was often already gone.

A data lake flips this. You store first and decide later. Every source writes its files into the lake in their original form. Later, an analyst, a data engineer or a machine learning job picks the files they need and gives them a shape at that moment.

Because storage is cheap and nearly unlimited (see Object Storage), keeping everything costs little. The hard part moves from storing data to finding and trusting it. A healthy lake adds a catalog (a list of what exists), zones (raw, cleaned, ready-to-use), and clear owners.

Many sources, one lake, many users
๐ŸงพApp logs
๐Ÿ—‚๏ธDatabase exports
๐Ÿ–ผ๏ธImages and audio
โ†’โ†“copy as it is
๐Ÿž๏ธData lakeobject storage
โ†’โ†“read and shape later
๐Ÿ“ŠAnalystsSQL
๐Ÿค–ML jobsraw files
๐Ÿ›๏ธWarehousecurated tables
The lake keeps files in their original form. Different users read the same files in different ways.
๐Ÿง Schema on write vs schema on read
A warehouse uses schema on write: check and shape the data as it goes in. A lake uses schema on read: store it raw, and apply the shape when you query. Schema on read is flexible. It also means bad data is only found when someone reads it.

03Real-Life Example

๐ŸตThe Storage Warehouse vs the Shop Shelf
Think of a big storage warehouse behind a shop. The shop shelf (a data warehouse) holds only neat, labelled products that customers are expected to buy. The storage warehouse (a data lake) takes everything that arrives: boxes, crates, loose parts, even things nobody has a plan for yet. It is cheap to keep. One day someone asks "do we have anything we can use for this new product?" and the answer is in the back. But if nobody labels the boxes or writes down what is where, the storage fills with unknown crates and staff stop trusting it. That is a swamp.
Storage warehouse
Data lake
Accept every delivery as it is
Store raw files with no reshaping
Cheap, huge floor space
Object storage, very low cost per TB
Sort the boxes only when you need them
Schema on read
A stock list with locations
A data catalog
Areas: unopened, checked, ready to ship
Zones: raw, cleaned, curated
Unlabelled crates piling up
A data swamp
Putting finished products on the shop shelf
Loading curated data into a warehouse
Zones inside a healthy lake
๐Ÿฅ‰Raw zoneexactly as received
โ†’โ†“clean, dedupe
๐ŸฅˆCleaned zonetyped, validated
โ†’โ†“join, aggregate
๐Ÿฅ‡Curated zoneready for reports
Data becomes cleaner and more trusted as it moves right. Many teams call these bronze, silver and gold.

04Why Do We Need It?

๐Ÿ’ฐCheap to keep everything
Object storage costs far less per terabyte than warehouse storage, so you can keep years of raw data.
๐Ÿ”ฎAnswer questions you have not thought of
The raw data is still there. A new question next year does not need a new collection started today.
๐ŸงฉAll kinds of data
Tables, JSON, logs, images, audio and video all fit. A warehouse mostly holds tables.
๐Ÿค–Machine learning needs raw files
Training jobs read images, text and logs directly. They cannot learn from a pre-summarised table.
๐Ÿ”ŒMany tools, one copy
Spark, Presto/Trino, Hive and cloud query engines can all read the same open files.
๐Ÿ“ˆScales out
Storage and compute are separate. Add compute when you need it, and keep the data without it.
Keep the raw data cheaply, and shape it only when you know the question. The price is that you must work to keep the lake organised.

05Where Do We Use It?

๐ŸงพLog and event collection
Clickstreams, app logs and device events land in the lake before anyone decides how to analyse them.
๐Ÿค–Machine learning
Feature and training data, images and text corpora are read straight from the lake.
๐Ÿ“ฆLong-term archive
Keep old data for audits and re-analysis at a low price, often in colder storage tiers.
๐Ÿ›๏ธFeeding a warehouse
The lake is the landing area. Cleaned, modelled data is then loaded into a warehouse for reports.
๐Ÿ”Replaying history
Fixed a bug in a pipeline? Re-run it over the raw data to produce corrected results.
๐ŸงชData science exploration
Analysts poke around in raw data to find out what is useful before building anything formal.

06Types / Parts / How It Works

How a lake is built: layers

Layers of a typical data lake
Consumersdashboards, notebooks, ML jobs
Query and processing enginesSpark, Trino/Presto, Hive, cloud SQL engines
Catalog and governancemetadata, schemas, access rules, lineage
File formatsParquet, ORC, Avro, JSON, CSV
Object storageS3, Azure Data Lake Storage, Google Cloud Storage
Storage and compute are separate, so each can grow on its own.

Common file formats

FormatLayoutGood for
CSV / JSONText, one row at a timeEasy to read and share. Large and slow to scan.
AvroBinary, row based, carries its schemaWriting streams of records and passing them between systems.
ParquetBinary, column based, compressedAnalytics: reads only the columns a query needs.
ORCBinary, column based, compressedSimilar to Parquet, common in Hive-based systems.

Lake, warehouse and swamp

Data lakeData warehouseData swamp
Data keptRaw, all kindsCleaned, modelled tablesRaw, unknown
SchemaOn readOn writeNone you can trust
UsersEngineers, data scientists, analystsAnalysts and business usersNobody, for long
Cost per TBLowHigherLow, but the value is also low
TrustDepends on zones and catalogHighLow
VisualizerLake or warehouse: which questions can you still answer?Switch between a lake and a warehouse, then change the question. Ask about a field nobody planned, then turn the housekeeping off and push the datasets above 100 to make a swamp.
Where does the data go?
What does the business ask?
Lake housekeeping (zones, catalog, owners)
What each source becomes
๐ŸงพApp logs (JSON)kept as a raw file
๐Ÿ–ฑ๏ธClickstreamkept as a raw file
๐Ÿ—‚๏ธDatabase export (CSV)kept as a raw file
๐Ÿ–ผ๏ธProduct imageskept as a raw file
๐Ÿ“กSensor readingskept as a raw file
โ†“copy as it is
๐Ÿž๏ธData lake100% of the data kept
Can we answer?
Yes
time: 3 min
Storage cost
100 units
illustrative, relative
Data kept
100%
of 100 TB
Time to find a dataset
2 min
depends on housekeeping
The raw files are still there, so you simply read them again with a new schema (schema on read). A scan of 100 TB takes about 3 min here (illustrative). Nothing needs to be reloaded.

A simple model, with no random numbers. Prices, times and the share of data a warehouse keeps are made-up round numbers to show the trade-off, not real benchmarks.

07How to Use It / Steps / Implementation

Building a lake that stays useful

  1. 1
    Start with questions, not just storage
    Know a few of the first users and what they need. A lake with no users becomes a swamp quickly.
  2. 2
    Land data raw, and never edit it
    Write each source into a raw zone exactly as received, with the date and source in the path. Raw data is your safety net for re-processing.
  3. 3
    Use a good folder layout
    Organise by source and date, for example sales/orders/date=2026-12-03/. Query engines use these paths to skip data they do not need (partitioning).
  4. 4
    Convert to Parquet for analytics
    In the cleaned zone store data in a columnar, compressed format. Queries then read less and cost less.
  5. 5
    Register everything in a catalog
    Record each dataset's location, schema, owner and meaning. If it is not in the catalog, it does not exist.
  6. 6
    Add quality checks between zones
    Check counts, nulls and types when data moves from raw to cleaned to curated. Reject or quarantine bad data.
  7. 7
    Control access
    Mark sensitive columns (personal data), limit who can read them, and keep an audit log. Plan how to delete a person's data when the law requires it.
๐Ÿ’กMany small files are slow
Streams that write a tiny file every second create millions of small files, and queries get slow. Batch writes into larger files (often tens to hundreds of MB), and compact small files regularly.
โš ๏ธA plain lake has no transactions
Files in a folder cannot be updated safely. A crashed job can leave half a day of data, and two jobs can clash. Table formats such as Delta Lake, Apache Iceberg and Apache Hudi fix this. See Data Lakehouse.

08Key Terms to Know

TermMeaning in easy words
Data lakeA large store that keeps raw data of any kind, usually on object storage
Schema on readGive the data a shape only when you read it, not when you store it
Schema on writeCheck and shape data before it is stored (the warehouse way)
Data swampA lake nobody can search or trust, because it has no catalog, owners or rules
Data catalogA searchable list of datasets with their location, schema, owner and meaning
Zones (bronze, silver, gold)Stages of data quality: raw, cleaned, ready to use
ParquetA compressed, column-based file format made for analytics
PartitioningSplitting files into folders (for example by date) so queries can skip what they do not need
Data lineageA record of where a dataset came from and what changed it
Object storageCheap storage of files as objects with a key, such as Amazon S3
Data governanceThe rules for who owns, can see and can change data

09Pros, Cons and Trade-offs

โœ… Pros
  • Very cheap storage for huge amounts of data
  • Keeps raw data, so old questions can be re-asked and new ones answered
  • Holds any kind of data, including images and logs
  • Good for machine learning and exploration
  • Open formats work with many tools
  • Storage and compute scale on their own
โš ๏ธ Cons
  • Becomes a swamp without a catalog and owners
  • Data quality problems appear only when data is read
  • Plain files have no transactions or safe updates
  • Slower than a tuned warehouse for business reports
  • Security and privacy need extra care
  • Many small files hurt performance

Trade-offs

ChoiceWe gainWe lose
Store raw, shape laterFlexibility and no lost historyQuality problems found late, more work at read time
Keep everythingCan answer future questionsStorage bills, privacy risk, clutter
Open file formatsMany tools can read it, no lock-inYou must manage layout and file sizes yourself
Separate storage and computeScale and pay for each on its ownNetwork reads are slower than local disks
Lake onlySimple, one placeWeaker speed and trust for business reports
Lake plus warehouseRaw for science, curated for reportsTwo systems and two copies to keep in sync

10Common Problems and Mistakes

Common mistakes

  1. No catalog. Files pile up, and nobody knows what they mean or if they are fresh.
  2. No owners. When a dataset breaks, nobody is responsible for fixing it.
  3. Editing raw data. Once the raw copy is changed, you cannot re-process from the truth.
  4. Too many small files. Queries spend most of their time opening files.
  5. Storing sensitive data with open access. A lake of everything is a rich target and a legal risk.
  6. Treating the lake as a database. Plain files do not support safe updates, deletes or concurrent writes.
  7. No lifecycle rules. Data is kept forever, long after it has any use.

Things to watch

๐ŸŠSwamp warning signs
Many datasets, few documented ones, and people asking in chat 'which table is right?'
๐Ÿ”Privacy rules
Laws such as GDPR can require deleting one person's data. Plan for this before you store it.
๐ŸŒSlow scans
Check file formats, file sizes and partitions before blaming the query engine.
๐ŸงพSchema drift
A source adds or renames a field and downstream jobs quietly break. Check schemas on arrival.

11Real-World Examples

โ˜๏ธCloud lakes
Amazon S3, Azure Data Lake Storage and Google Cloud Storage are the usual foundations for lakes.
๐Ÿ˜Hadoop era
Early lakes ran on HDFS in Hadoop clusters. Most teams have since moved to cloud object storage.
๐Ÿ› ๏ธQuery engines
Spark, Trino, Presto, Hive and managed services such as Athena query lake files directly.
๐Ÿ“šCatalogs
Hive Metastore, AWS Glue and similar services keep the dataset lists and schemas.
๐Ÿš—Sensor and event data
Companies with fleets of devices keep raw readings in a lake to train and improve models.
๐Ÿ›’E-commerce analytics
Clickstream and order data land raw, then flow to curated tables for dashboards.
๐Ÿ“Note
Product names and features change over time. Check the current documentation before choosing tools.
Mini case: lake in front of a warehouse
๐ŸงพSourcesapps, devices, DBs
โ†’โ†“ingest
Data lake
๐Ÿฅ‰Raw
๐ŸฅˆCleaned
๐Ÿฅ‡Curated
โ†’โ†“load
๐Ÿ›๏ธWarehousereports
Raw Cleaned Curated
The lake keeps everything. Only the cleaned, modelled part moves to the warehouse for business reports.

12Related Topics to Read Next

Data Warehousingโ†’

The curated, modelled side that often sits next to a lake.

Data Lakehouseโ†’

Adds tables and transactions on top of lake storage.

Object Storageโ†’

The cheap storage a lake is built on.

ETL Pipelinesโ†’

How data is moved into, and shaped inside, a lake.

Batch vs Stream Processingโ†’

Two ways to fill and process a lake.

Data Formatsโ†’

Parquet, Avro, JSON and CSV compared.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • โœ”What: a cheap store of raw data of every kind, usually on object storage.
  • โœ”Idea: store first, decide the shape later (schema on read).
  • โœ”Zones: raw (bronze), cleaned (silver), curated (gold).
  • โœ”Formats: Parquet or ORC for analytics, Avro for records, JSON and CSV for exchange.
  • โœ”Must have: a catalog, owners, quality checks and access rules.
  • โœ”Risk: a data swamp, which is lots of data that nobody trusts.
  • โœ”Limit: plain files have no transactions. Use Delta, Iceberg or Hudi for that.
  • โœ”One line: โ€œKeep everything cheaply, but label it, or it turns into a swamp.โ€
โ† Previous
ETL Pipelines
Next โ†’
Data Warehousing