Data Storage Architectures

Data lakes, warehouses, and lakehouses.

Modern Data Storage Evolution

As organizations collect more data from diverse sources, traditional databases alone aren't enough. Modern data architectures have evolved to handle massive scale, varied data types, and complex analytics. Data warehouses provide structured analytics, data lakes offer flexible raw storage, and data lakehouses combine the best of both worlds. Understanding these architectures is crucial for building scalable data platforms.

The Evolution of Data Storage

1980s-1990s: Data Warehouses

Structured, curated data for business intelligence and reporting

2000s-2010s: Data Lakes

Store everything raw and cheap, figure out structure later

2020s: Data Lakehouses

Best of both: flexibility of lakes + structure of warehouses

Data Warehouses

Structured, optimized for analytics

A data warehouse is a centralized repository of integrated data from multiple sources, optimized for analysis and reporting. Data is cleaned, transformed, and structured before loading (ETL - Extract, Transform, Load). Think of it as a highly organized library where everything is cataloged and easy to find.

Key Characteristics

๐Ÿ“Š Structured Schema

Data follows predefined tables and relationships (star/snowflake schema)

๐ŸŽฏ Optimized Queries

Built for fast analytical queries (OLAP) with aggregations and joins

๐Ÿงน Clean Data

Data is transformed and validated before storage (high quality)

๐Ÿ“ˆ Historical Data

Designed for time-based analysis and trend reporting

Data Modeling Designs

Most common warehouse design with fact tables (metrics) surrounded by dimension tables (context).

Star Schema: one fact table surrounded by dimension tables

DIM_DATEdate_key (PK)monthquarterDIM_CUSTOMERcustomer_key (PK)nameregionDIM_PRODUCTproduct_key (PK)namecategoryFACT_SALESdate_key (FK)customer_key (FK)product_key (FK)quantityrevenueprofit

Figure: Each dimension's primary key reappears as a foreign key in the central fact table. The fact table stores the measurements (quantity, revenue, profit); dimensions stay denormalized so analytic joins are only one hop deep.

Star Schema

Simple, denormalized design for fast queries

Star schema is the simplest dimensional model, consisting of one central fact table surrounded by dimension tables. The fact table contains measures and foreign keys to dimensions, while dimensions hold descriptive attributes. It resembles a star shape.

Key Characteristics

โญ Central Fact Table

Contains quantitative measures and keys to dimensions

๐ŸŒŸ Denormalized Dimensions

Flat tables with all attributes, minimizing joins

๐Ÿš€ Query Performance

Optimized for star-join queries in OLAP

๐Ÿ›  Easy to Understand

Intuitive for business users and BI tools

Pros & Cons

Pros
  • Fast query performance
  • Simple design
  • Easy to implement hierarchies
  • Good for reporting
Cons
  • Data redundancy
  • Less normalized
  • Update anomalies possible
  • Larger storage needs
Deep Insight: Star schema sacrifices normalization for query speed, but in big data contexts with immutable data, update anomalies are less concerning. Consider how denormalization affects storage costs in cloud environments.

Snowflake Schema

Normalized extension of star schema

Snowflake schema normalizes dimension tables into multiple related tables, reducing redundancy. It looks like a snowflake with the fact table at the center and normalized dimensions branching out.

Snowflake Schema: the same star, with DIM_PRODUCT normalized into a chain

DIM_DATEdate_key (PK)monthquarterDIM_CUSTOMERcustomer_key (PK)nameregionFACT_SALESdate_key (FK)customer_key (FK)product_key (FK)quantityrevenueprofitDIM_PRODUCTproduct_key (PK)namecategory_key (FK)DIM_CATEGORYcategory_key (PK)category_namedept_key (FK)DIM_DEPARTMENTdept_key (PK)dept_name

Figure: The star's single DIM_PRODUCT is split into DIM_PRODUCT -> DIM_CATEGORY -> DIM_DEPARTMENT. Redundant category and department names are stored once each, but reading a product's department now costs extra joins along the chain.

Key Characteristics

โ„๏ธ Normalized Dimensions

Dimensions split into sub-tables

๐Ÿ’พ Reduced Redundancy

Less data duplication than star

๐Ÿ”— More Joins

Requires additional joins for queries

๐Ÿ“Š Complex Hierarchies

Better for multi-level dimensions

Pros & Cons

Pros
  • Efficient storage
  • Easier updates
  • Less redundancy
  • Better data integrity
Cons
  • Slower queries (more joins)
  • More complex design
  • Harder for BI tools
  • Increased maintenance
Deep Insight: Snowflake trades query performance for storage efficiency, but in era of cheap storage and powerful query engines, the performance hit may be negligible. Evaluate based on your specific query patterns and data volume.

Galaxy Schema

Complex, multi-fact design

Also known as fact constellation schema, galaxy schema features multiple fact tables sharing common dimension tables. It's used for complex reporting across related business processes.

Key Characteristics

๐ŸŒŒ Multiple Fact Tables

Several interconnected facts

๐Ÿ”— Shared Dimensions

Conformed dimensions across facts

๐Ÿ“Š Complex Analysis

Supports cross-fact queries

๐Ÿ— Scalable Design

For enterprise-wide data marts

Pros & Cons

Pros
  • Handles complex relationships
  • Reuses dimensions
  • Supports multiple views
  • Enterprise scalability
Cons
  • More complex queries
  • Higher design effort
  • Potential performance issues
  • Maintenance challenges
Deep Insight: Galaxy schema enables holistic analysis across business domains but can lead to query complexity. In distributed systems, consider how shared dimensions affect data locality and join performance.

Popular Platforms

Snowflake

Cloud-native, auto-scaling, separation of storage/compute

BigQuery

Google's serverless, petabyte-scale, SQL interface

Redshift

AWS managed, columnar storage, MPP architecture

Synapse

Azure's analytics service, unified experience

Example: Warehouse Query

SELECT
    d.quarter,
    p.category,
    SUM(f.revenue) AS total_revenue,
    AVG(f.profit) AS avg_profit
FROM fact_sales f
JOIN dim_date d ON f.date_key = d.date_key
JOIN dim_product p ON f.product_key = p.product_key
WHERE d.year = 2024
GROUP BY d.quarter, p.category
ORDER BY total_revenue DESC;
Result:
Q4 | Electronics | $2.5M | $450K
Q4 | Furniture | $1.8M | $320K
Q3 | Electronics | $2.1M | $380K
(Fast aggregation across millions of rows)

When to Use

  • Business intelligence and reporting
  • Historical analysis and trends
  • Structured data with known schema
  • Complex SQL queries and joins
  • Regulatory compliance requiring governance
  • Need for high query performance

Pros & Cons

Pros
  • Extremely fast analytics queries
  • High data quality and governance
  • Optimized for BI tools
  • Well-understood SQL interface
  • Strong consistency guarantees
  • Great for compliance/auditing
Cons
  • Expensive storage costs
  • Schema must be defined upfront
  • ETL pipelines are complex
  • Difficult to handle unstructured data
  • Not suitable for real-time data
  • Vendor lock-in with proprietary formats
๐Ÿ’ก Best Practice: Use data warehouses when you have well-defined analytics needs and structured data. Design your schema carefully, star schemas for simplicity, snowflake schemas for normalization. Partition large tables by date for better performance.

Data Lakes

Store everything raw, transform on read

A data lake is a centralized repository that stores all structured and unstructured data at any scale. Data is stored in its raw format and transformed only when needed (ELT - Extract, Load, Transform). Think of it as a massive parking lot where you dump everything, you organize it later when you need it.

Key Characteristics

๐Ÿ“ฆ Schema-on-Read

No predefined schema, structure is applied when data is read

๐Ÿ’ฐ Low-Cost Storage

Built on cheap object storage (S3, Azure Blob, GCS)

๐Ÿ”„ All Data Types

Structured, semi-structured, unstructured (CSV, JSON, Parquet, images, logs)

๐Ÿ”ฌ Exploratory Analysis

Great for data science, ML, and discovering new insights

Architecture: Zones/Layers

Data lakes typically organize data into zones representing data maturity.

Medallion Architecture: Bronze -> Silver -> Gold

Bronze / Rawraw files, no schema, immutableSilver / Processedcleaned, validated, enrichedGold / Curatedbusiness-ready, aggregatedclean & validateaggregate

Figure: Data is refined in stages within one lake. Each zone is a checkpoint you can reprocess from, and consumers read the zone that matches their trust and latency needs.

Data progresses from raw โ†’ processed โ†’ curated as it's refined

Popular Platforms

AWS S3

+ Athena for queries, Glue for ETL

Azure Data Lake

+ Databricks, Synapse for processing

Google Cloud Storage

+ BigQuery, Dataproc for analytics

Hadoop HDFS

On-premise distributed file system

Example: Querying Raw Data

Store Raw JSON Logs
// Upload to S3
aws s3 cp application.log s3://my-data-lake/raw/logs/2024/01/15/

// File contains raw JSON
{"timestamp": "2024-01-15T10:30:00", "user_id": "123", "action": "purchase", "amount": 49.99}
{"timestamp": "2024-01-15T10:31:15", "user_id": "456", "action": "view", "product": "laptop"}
{"timestamp": "2024-01-15T10:32:00", "user_id": "123", "action": "review", "rating": 5}
Result:
Raw logs stored in S3, no transformation yet
Query with Athena (Schema-on-Read)
CREATE EXTERNAL TABLE logs (
  timestamp STRING,
  user_id STRING,
  action STRING,
  amount DOUBLE,
  product STRING,
  rating INT
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://my-data-lake/raw/logs/2024/01/15/';

-- Now query it like a table
SELECT
  action,
  COUNT(*) as count,
  AVG(amount) as avg_amount
FROM logs
WHERE action = 'purchase'
GROUP BY action;
Result:
purchase | 156 | $67.45
(Schema applied at query time, not storage time)

When to Use

  • Storing massive amounts of raw data cheaply
  • Machine learning and data science workloads
  • Unstructured data (logs, images, videos)
  • Exploratory analysis and discovery
  • Long-term data retention and archival
  • Diverse data sources with unknown future uses

Pros & Cons

Pros
  • Very cheap storage
  • Flexible, store anything
  • Scalable to petabytes
  • Great for ML/data science
  • No upfront schema design
  • Separation of storage and compute
Cons
  • Can become "data swamps" (unorganized)
  • Poor data quality without governance
  • Slower queries than warehouses
  • No ACID transactions
  • Difficult to ensure data consistency
  • Requires skilled engineers to query effectively
โš ๏ธ Data Swamp Warning: Without proper governance, cataloging, and organization, data lakes quickly become "data swamps", repositories where data goes to die. Use tools like AWS Glue Catalog, Azure Purview, or Apache Atlas to maintain metadata and discoverability.

Data Lakehouses

Best of both worlds: flexibility + performance

A data lakehouse combines the flexibility and cost-effectiveness of data lakes with the performance and structure of data warehouses. It adds a metadata and governance layer on top of cheap object storage, enabling ACID transactions, schema enforcement, and fast queries, all while maintaining the ability to store any data type.

Key Characteristics

โšก ACID Transactions

Support for transactions on data lake storage (Delta Lake, Iceberg, Hudi)

๐Ÿ“‹ Schema Enforcement

Optional schema validation while keeping schema evolution flexibility

๐Ÿ”„ Time Travel

Query historical versions of data for auditing and recovery

๐ŸŽฏ Fast Queries

Warehouse-like performance with indexing and optimization

Architecture: Open Table Formats

Lakehouses use open table formats that add structure and governance to data lakes.

Lakehouse Layered Architecture

Query EnginesSpark, Presto, TrinoTable FormatDelta / Iceberg / Hudi: ACID, schema, time travelObject StorageS3 / ADLS / GCS: Parquet/ORC, cheapSQL / DataFramereads/writes files

Figure: The open table format is the layer that makes a lakehouse. It sits between query engines and cheap object storage, adding ACID transactions, schema enforcement, and time travel on top of plain Parquet files.

Metadata layer enables warehouse features on lake storage

Popular Platforms & Formats

Databricks

Delta Lake format, unified analytics platform

Apache Iceberg

Open format, multi-engine support, Netflix-created

Apache Hudi

Upserts and incremental processing, Uber-created

Example: Delta Lake Operations

Create Delta Table
-- Create table with ACID guarantees
CREATE TABLE customer_orders (
  order_id STRING,
  customer_id STRING,
  order_date DATE,
  amount DECIMAL(10,2)
)
USING DELTA
LOCATION 's3://my-lakehouse/tables/customer_orders';
Result:
Delta table created with transaction log for ACID operations
ACID Updates (Impossible in Pure Data Lake)
-- Update existing records atomically
UPDATE customer_orders
SET amount = amount * 1.1
WHERE order_date >= '2024-01-01';
Result:
Updated 15,234 rows atomically (all or nothing)
Time Travel
-- Query data as it was at a specific version
SELECT * FROM customer_orders
VERSION AS OF 3;

-- Or by specific timestamp
SELECT * FROM customer_orders
TIMESTAMP AS OF '2024-01-15T10:00:00';
Result:
Returns historical snapshot for auditing or rollback
Upserts (Merge)
MERGE INTO customer_orders AS target
USING new_orders AS source
ON target.order_id = source.order_id
WHEN MATCHED THEN
  UPDATE SET target.amount = source.amount
WHEN NOT MATCHED THEN
  INSERT *;
Result:
Updated 50 existing orders, inserted 200 new orders (single transaction)
Schema Evolution
-- Add new column without rewriting all data
ALTER TABLE customer_orders
ADD COLUMN discount_applied BOOLEAN;
Result:
Schema updated, new column added (old records have NULL values)

When to Use

  • Need both analytics AND ML/data science
  • Want warehouse performance at lake costs
  • Require ACID transactions on data lake
  • Streaming and batch processing together
  • Need to update/delete data efficiently
  • Want unified architecture (one platform)

Pros & Cons

Pros
  • Combines lake flexibility + warehouse performance
  • ACID transactions on cheap storage
  • Schema enforcement + evolution
  • Time travel and versioning
  • Open formats (no vendor lock-in)
  • Unified platform for all workloads
Cons
  • Newer technology (less mature)
  • Requires Spark or similar engine
  • More complex to set up than lake/warehouse
  • Still evolving best practices
  • Metadata overhead
  • Learning curve for operations
๐Ÿ’ก Best Practice: Choose an open table format (Delta, Iceberg, or Hudi) to avoid vendor lock-in. Use partitioning and Z-ordering for performance. Implement data quality checks before writing. Set retention policies for time travel to manage storage costs.

Side-by-Side Comparison

FeatureData WarehouseData LakeData Lakehouse
Data TypesStructured onlyAll typesAll types
SchemaSchema-on-write (predefined)Schema-on-read (flexible)Both (enforced + flexible)
Storage CostHigh ($$)Low ($)Low ($)
Query PerformanceExcellentGood to PoorVery Good
ACID Transactionsโœ… YesโŒ Noโœ… Yes
Data QualityHigh (validated)VariableHigh (optional enforcement)
Use CasesBI, reporting, dashboardsML, data science, archivesAll of the above
UsersBusiness analystsData scientists, engineersEveryone
ETL PatternETL (transform before load)ELT (transform after load)Both
Updates/DeletesEasyDifficult (rewrite files)Easy (ACID support)

Choosing the Right Architecture

Choose Warehouse When...
  • Data is all structured
  • Schema is stable and known
  • Need fastest query performance
  • BI/reporting is primary use case
  • Budget allows higher costs
  • Strong governance required
Choose Lake When...
  • Lots of unstructured data
  • Exploratory/experimental work
  • ML and data science focus
  • Need cheapest storage
  • Schema unknown/changing
  • Long-term archival
Choose Lakehouse When...
  • Need both BI AND ML/DS
  • Want unified platform
  • Require ACID on cheap storage
  • Streaming + batch together
  • Open formats preferred
  • Modern, future-proof choice
โœจ Modern Recommendation: Most new projects should default to a lakehouse architecture. It provides the flexibility to handle diverse workloads while maintaining good performance and governance. Only choose a pure warehouse if you have very specific, well-understood BI needs, or a pure lake if you're doing purely experimental work.

Real-World Data Platform Architecture

Most organizations use a combination of these architectures. Here's a modern data platform:

A Modern Data Platform, End to End

Data SourcesDBs, APIs, logs, IoT, filesIngestion LayerKafka, Firehose, AirflowCacheRedisLakehouseDelta: Bronze/Silver/GoldOperational DBPostgreSQLProcessing EnginesSpark, Flink, dbtServing LayerBI, ML, APIs, dashboardscollectstoretransformserve

Figure: Sources feed an ingestion layer that lands data in the lakehouse (plus a cache and operational store). Processing engines refine data in place through the medallion zones, and the serving layer exposes it to BI, ML, and applications.

Modern architecture with lakehouse as central store, specialized systems for specific needs

Layer Breakdown

Ingestion

Collect data from all sources, handle both streaming and batch

Storage (Lakehouse)

Central repository with Bronze (raw) โ†’ Silver (cleaned) โ†’ Gold (curated) zones

Processing

Transform data using Spark for big data, dbt for SQL transformations

Serving

Expose data via BI tools, APIs, ML models, and custom applications

Emerging Pattern: Data Mesh

Data Mesh is a newer architectural paradigm that treats data as a product, with domain teams owning their data. Instead of one central data lake/warehouse, each domain has its own data products that others can consume.

๐Ÿข
Domain Ownership

Teams own their data end-to-end

๐Ÿ“ฆ
Data as Product

Treat data like software products

๐Ÿ”ง
Self-Serve Platform

Infrastructure as a platform

๐Ÿ“
Federated Governance

Global standards with local control

Deep Insight: Data Mesh shifts from centralized control to decentralized ownership, mirroring microservices. However, it requires sophisticated federation to avoid silos, think about the balance between autonomy and interoperability in large organizations.

Key Takeaways

  • Data Warehouses prioritize structure and performance for analytics but lack flexibility.
  • Data Lakes offer cost-effective storage for diverse data but risk becoming ungovernable swamps.
  • Data Lakehouses merge benefits, enabling ACID on scalable storage for modern workloads.
  • Real-World Platforms layer ingestion, processing, and serving around a central lakehouse.
  • Data Mesh decentralizes ownership, treating data as products for organizational scale.
What's Next?

With storage architectures understood, dive into building data pipelines in the next lesson.