Row-Based vs. Columnar Storage

The most fundamental storage decision

How data is physically laid out on disk

WhatWhy
What it is

The same logical table can be physically stored in two fundamentally different ways. Row-based storage keeps all columns of a single record together on disk. Columnar storage keeps all values of a single column together. This seemingly simple difference has massive implications for query performance, compression, and use case fit.

Why it matters

Choosing the wrong layout for your workload means either reading far more data than needed (row store for analytics) or paying a heavy penalty for single-record mutations (column store for transactions). Understanding this trade-off is foundational to every storage and format decision you will make.

Row-Based Layout (OLTP)
IDNameAmountDate
1Alice250Jan 5
2Bob180Jan 6
3Carol420Jan 7
Reads entire rows together. Fetching one customer's full record is a single I/O operation. Ideal for CRUD operations and point lookups. Examples: PostgreSQL, MySQL, SQL Server.
Columnar Layout (OLAP)
ID col123
Name colAliceBobCarol
Amount col250180420
Date colJan 5Jan 6Jan 7
Reads only needed columns. SUM(Amount) scans just the Amount column, skipping Name, Date, etc. 5 to 30x compression on homogeneous data. Examples: Snowflake, BigQuery, Parquet files.
PropertyRow-BasedColumnar
Best forTransactions (OLTP), CRUDAnalytics (OLAP), aggregations
I/O patternRead/write full rowsRead only needed columns
Compression1.5 to 3x5 to 30x
Single-row updateFast (localized)Slow (scattered across files)
Analytical scanReads unused columnsReads only queried columns
ConcurrencyHigh (thousands of users)Lower (analyst workloads)
ExamplesPostgreSQL, MySQL, OracleSnowflake, BigQuery, ClickHouse, Parquet

File Formats

Parquet, Avro, ORC, JSON, CSV

Apache Parquet: the default analytical format

What it is

Parquet is an open-source columnar file format designed for efficient analytical workloads. It stores data column-by-column, enabling engines to read only the columns needed for a query. It uses row groups (128 MB default) for parallelism and per-column statistics (min/max) for predicate pushdown.

Why it dominates
  • Columnar: only reads columns needed by the query
  • Compression: Snappy, ZSTD, or GZIP per column; 5 to 10x space savings
  • Statistics: min/max per row group enable skipping irrelevant data
  • Ecosystem: read by Spark, DuckDB, Polars, Pandas, BigQuery, Snowflake, and every major engine
  • Schema embedded: the file carries its own schema (self-describing)
FormatLayoutSchemaBest forCompression
ParquetColumnarEmbeddedAnalytics, data lakesExcellent
AvroRow-basedEmbedded (JSON)Streaming, Kafka, schema evolutionGood
ORCColumnarEmbeddedHive ecosystemExcellent
JSONRow-basedImplicitAPIs, logs, flexibilityPoor (verbose)
CSVRow-basedNoneSimple interchangePoor

Lake, Lakehouse, and Warehouse

Three storage architectures, three trade-offs

Interactive: Compare storage architectures

Select an architecture to understand its strengths and trade-offs.

Data Lake: Scalable, flexible, schema-on-read

What: Object storage (S3, ADLS, GCS) holding files in many formats (Parquet, JSON, CSV, images, video). No built-in table semantics or transaction support. Strengths: Cheapest storage option, supports any data type, decouples storage from compute. Limitation: No ACID transactions, no schema enforcement, quality depends entirely on discipline. Without governance, it becomes a "data swamp."

FeatureData LakeData WarehouseLakehouse
StorageObject storage (cheap)Proprietary (expensive)Object storage (cheap)
ACIDNoYesYes (via table format)
SchemaOn readOn writeBoth
SQL performanceVariableOptimizedGood (improving)
Data typesAny (structured, semi, unstructured)Structured onlyAny
Vendor lock-inLowHighLow (open formats)

Table Formats

Making files behave like tables

Delta Lake, Apache Iceberg, and Apache Hudi

What they solve

A table format is a metadata layer on top of files (usually Parquet) that adds ACID transactions, schema evolution, time travel, and partition management to plain object storage. This is what transforms a data lake into a lakehouse.

The three leading formats
  • Delta Lake (Databricks): Uses a JSON transaction log (_delta_log). Tight Spark integration. Supports MERGE, UPDATE, DELETE. Default on Databricks.
  • Apache Iceberg (Netflix): Uses manifest files and snapshots. Strong partition evolution (change partition scheme without rewriting data). Growing multi-engine support. Default on Snowflake and AWS.
  • Apache Hudi (Uber): Designed for streaming upserts. Copy-on-write and merge-on-read modes. Best for CDC and incremental pipelines.

Partitioning and the small files problem

Partitioning

Partitioning divides data into directories based on column values (e.g., date, region). When a query filters on the partition column, the engine skips irrelevant partitions entirely (partition pruning). Well-chosen partitions can reduce scan volume by 10 to 100x.

The small files problem

Frequent writes (especially streaming) create thousands of tiny files. Each file requires metadata overhead and a separate I/O operation. The result: queries slow down dramatically as the number of files grows, even if total data volume is small. Solutions include compaction (merge small files into larger ones), bin-packing, and auto-optimize features in Delta Lake and Iceberg.

Knowledge Check: Module 3

1. Why is columnar storage better for analytical queries?

Columnar storage stores each column separately, so a query like SUM(amount) reads only the amount column, skipping all other columns. Homogeneous data within a column also compresses much better (5 to 30x).

2. Which file format is the de facto standard for analytical data in modern data lakes?

Parquet is the standard columnar file format for data lakes. It offers excellent compression, column pruning, predicate pushdown via min/max statistics, and is supported by every major processing engine.

3. What does a table format (Delta Lake, Iceberg, Hudi) add to plain files in object storage?

Table formats add a metadata layer that gives files the behavior of database tables: ACID guarantees, schema evolution, time travel (query past snapshots), and intelligent partition management.

4. What is the "small files problem" in data lakes?

Each file requires a separate I/O operation and metadata entry. Thousands of small files (common with streaming writes) overwhelm the metadata layer and degrade query performance, even if total data size is small. The fix is compaction.

5. What distinguishes a lakehouse from a traditional data lake?

A lakehouse combines the economics of object storage (data lake) with the reliability of a warehouse (ACID, schema enforcement) by using a table format like Delta Lake or Iceberg on top of files.