Picking the Right Storage Shape

Picking a shape for a new workload comes down to 3 questions, asked in order: how will the data be read, how fresh does it need to be, and how much of it is there. The answers usually point at 1 shape, and when they point at 2, the second is a copy fed by a pipeline.

QuestionIf the answer isPoints toward
Access pattern1 row by key, read and written by the appOperational database
Access patternMany rows, few columns, summed or countedData warehouse
Access patternWhole files reread, raw fields kept for years, formats mixedData lake
FreshnessThe instant it is writtenOperational database, where the write happens
FreshnessMinutes to hours behind the writeWarehouse or lake, fed by a batch or streaming copy
FreshnessDays old is fine; read once or rarelyData lake
ScaleGigabytes of hot, changing rowsOperational database
ScaleTerabytes of typed tablesData warehouse
ScaleTerabytes to petabytes, mixed formats, each byte read rarelyData lake

The operational database is the freshest copy by definition, which tempts people to read it for everything. Ask instead whether the consumer can tell the difference. A dashboard opened at 9 am and compared with yesterday can't tell whether the orders are 10 seconds or 10 hours old, so it belongs on a warehouse loaded overnight. A courier deciding which door to knock on can tell, so that read stays on the operational database.

Placing 5 workloads

WorkloadAccessFreshnessScaleShape
Courier app shows 1 order1 row by id, then an updateNowGigabytes, hotOperational database
Morning revenue dashboardSum 3 columns over 60 million rowsDailyTerabytesWarehouse
Train a delivery time model on 2 years of eventsEvery field of every fileWeeklyTens of terabytesLake, raw and cleaned
Month-end finance closeTyped joins across 3 tablesMonthlyTerabytesWarehouse
Fix a cleaning rule and rebuild 3 daysReread the original filesOnceTerabytesLake, raw zone
Orders are written once on the left and copied rightward into the shape each reader needs.
  • Checkout app (source, mobile and web)
  • Operational database (storage, row layout, ACID)
  • Lake raw zone (bronze, JSON files)
  • Lake cleaned zone (silver, Parquet files)
  • Warehouse (gold, columnar tables)
  • Revenue dashboard (consumer, every morning)
  • Model training (consumer, weekly)
  • Checkout app -> Operational database
  • Operational database -> Lake raw zone
  • Lake raw zone -> Lake cleaned zone
  • Lake cleaned zone -> Warehouse
  • Warehouse -> Revenue dashboard
  • Lake cleaned zone -> Model training
  • Application: Checkout app, Operational database
  • Lake: Lake raw zone, Lake cleaned zone
  • Serving: Warehouse, Revenue dashboard, Model training

Read the diagram left to right. The operational database is the only place a person writes an order. Everything to its right is a copy carried by a nightly batch or a stream, and each reader takes the copy whose shape and freshness fit its need.

A support agent has a customer on the phone and needs to see the customer's 5 most recent orders, each with its current status. Where should the support tool read?

3 placement mistakes

Each layer you add is also a pipeline you own, so add a shape when its question arrives. A new app with 2 GB of orders can run its morning report on a nightly copy of the operational database for a year. The warehouse arrives when that report takes minutes, and the lake when someone needs events a cleaning rule threw away or untyped events pile up. Pipeline Anatomy's test for when a pipeline is not needed applies to storage layers too.

The app team wants to capture every tap and scroll, about 50 billion events a month with no agreed fields yet. For the first quarter, only 1 exploring team reads them. Where should the events land first?

About this lesson

This section is part of the Storage Layers: Beginner lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.