beginnerdata-warehousing

OLAP vs OLTP

Two completely different jobs, two completely different database designs.

Key Points

What it is

OLTP (Online Transaction Processing) systems handle the day-to-day operations of a business — individual inserts, updates, and deletes in real time. OLAP (Online Analytical Processing) systems are built for querying large volumes of historical data to support analysis and reporting. They're designed differently because they're used differently.

Why it exists

The workloads are fundamentally different in shape. A customer placing an order touches maybe 5 rows across 3 tables. A finance team asking 'what was our revenue by region last quarter?' might scan 50 million rows. The same database can't be optimally designed for both at the same time.

Intuition

OLTP is the cash register. Every transaction is small, fast, and happens constantly. The register needs to be quick and always available. OLAP is the end-of-day report. It runs once, scans everything, and produces a summary. You don't want your end-of-day report locking up the register while customers are in line. So you run them separately. The register (OLTP) takes orders all day. At night, data gets copied to a separate system (data warehouse) where the OLAP queries run freely without bothering anyone.

When to use

Common mistakes

Notes

In practice

Every data warehouse you work in is an OLAP system. Understanding why it's separate from the production database explains why data can be a few hours stale, why the schema looks different from the application schema, and why batch loads exist.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

etl-pipelinesstar-and-snowflake-schemanormalization
Chirp at me!