OLTP, OLAP and Columnar Storage

Two workloads that want opposite things from disk, and the storage layout that serves each.

OLTP, OLAP and Columnar Storage

The two workloads on one table

query.sql SQLite
Result

Worth knowing

OLTP: many small transactions touching whole rows. OLAP: few huge queries touching a few columns.
A row store keeps a row's fields together, so reading one row is one page read. Reading one column reads every page.
A column store keeps each column together, so an aggregate reads only the columns it names.
Columns of one type compress far better than mixed rows — often ten times — and less data read is the actual speed-up.

Overview

Online Transaction Processing (OLTP) handles many small operations that read or change a few records, such as placing an order. It usually needs low-latency lookups, concurrent writes, and transactional guarantees.

In this guide
  1. Two workload shapes
  2. Rows and columns
  3. Choose for the workload
  4. Example: two queries, two bottlenecks
  5. Measure interference, not labels
  6. Further reading

Two workload shapes

Online Analytical Processing (OLAP) answers questions across large datasets, such as monthly revenue by region. It often reads many rows but only a few columns, and can benefit from scans and aggregation. These are workload patterns, not mutually exclusive kinds of product. A system may support both, though one workload can interfere with the other.

Rows and columns

A row-oriented layout keeps fields from one record together, which suits retrieving or updating a complete record. A columnar layout stores values from the same column together. An analytic query that reads only region and revenue can avoid unrelated fields and may compress repeated values well.

Column storage does not guarantee a particular speedup. Results depend on compression, data distribution, query shape, hardware, and engine. Column stores also have trade-offs for point updates and transactional access.

Choose for the workload

Start from actual query and concurrency needs. Use a transactional store for frequent, small updates; use an analytical warehouse or columnar engine when broad scans and aggregations dominate. Moving data between systems introduces freshness, failure, and reconciliation questions. Benchmark both workloads under realistic concurrency. For an analytical dimensional design, see star schema.

Example: two queries, two bottlenecks

A checkout query that fetches one customer's current cart needs a fast point lookup and a small write. A monthly revenue report may scan many transactions, group them by region, and return only a few columns. The first workload tends to value predictable response time under concurrent updates; the second values scan throughput and compression. Combining them on one system can work at modest scale, but a large report may compete with checkout. Run representative concurrent tests before separating the workloads.

Measure interference, not labels

A mixed workload can remain on one engine if transactions and reports meet their latency targets. Measure transaction p95 latency while the analytical query runs, not only each query in isolation. If the report disrupts writes, options include a replica, scheduled extraction, workload limits, or a dedicated warehouse. Each introduces data freshness and operational cost. Row versus column storage is one design factor; caching, indexes, partitioning, concurrency control, and hardware also affect the outcome.

Further reading

Check yourself

0 of 3

Answer without scrolling back up.

  1. Why is a row store slow at averaging one column over ten million rows?

  2. Why do column stores compress so much better?

  3. What goes wrong when reports run against the production OLTP database?

Cheat sheet

OLTP, OLAP and Columnar Storage

Compare row storage and columnar storage on the same table, run an analytical query on each, and see why dashboards need a different engine.

DATABASE · vizlearn.in/database/oltp_vs_olap_columnar.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.

Teaching a course with this? Individual teachers can use it freely; for a whole department or programme, see institutional licences.