Bookmarks

OLTP — online transaction processing

A class of database workloads in which the system continuously processes many short transactions — orders, payments, transfers — with the outcome of each visible straight away.

Also: OLTP system, OLTP workload, online data processing

checked 18 Nov

All terms

OLTP is a database workload profile for systems where every user operation immediately and reliably changes data: online shops, banks, taxi services, billing. The system lives as long as the stream of such operations flows, so it is expected to respond quickly and keep strict integrity — money and orders must not be lost or duplicated.

How OLTP differs from OLAP

The term is almost always mentioned alongside OLAP: the same organisation stores data both for running the business “now” and for analysing “years of history”, but the workloads behind these tasks are opposites.

PropertyOLTPOLAP
Workloadmany short transactions: inserting and updating individual rowsa few long queries over millions of rows
Schemanormalised, no duplication on writestar schema, built for aggregations
Datacurrent state, row storageyears of history, often columnar storage
Responsefast: the result is needed at oncelong queries are acceptable
Examplea money transfer, placing an orderrevenue by region for a quarter

What matters for an OLTP system

  • ACID transaction properties: a transfer is either applied in full or rolled back — there will be no double charge.
  • Indexes for point queries: a lookup by key must find the row quickly rather than scan the table.
  • Concurrency: many simultaneous sessions, hence row-level locks and row versions instead of locking the whole table.
  • Row storage: the whole row sits together so that reading and updating a record is a single operation.
  • Write scaling: replication takes the read load off, and sharding spreads data across nodes when a single server cannot cope.

The transactions themselves stay short: each operation is wrapped in one small transaction. A long yearly sales report running on the same database gets in the way of orders, so such queries are usually moved to a separate data mart or data warehouse.

Sources

the term is written from these pages

Verified 18 Nov

Not to be confused with

what it is mixed up with and how it differs

  • OLAPAnalytical processing

    OLAP answers analytical questions over large volumes of history; OLTP serves the day-to-day operations from which that history is later assembled.

  • DWHdata warehouse

    A data warehouse collects data from OLTP systems for reports; the OLTP system itself is optimised for writing, not for analytics.

In depth in the references

where the topic is covered in detail