Part 3 of 10
Data warehousing
At first one database served both OLTP and analytics, since SQL can express both kinds of query. From the late 1980s and early 1990s, companies started moving analytics into a separate database called a data warehouse.
Guess first
Analysts want a heavy report over a whole year of rides. Where should it run?
A large company may run dozens or hundreds of OLTP systems, such as the website, shop tills, stock tracking, delivery routes, suppliers, and staff records. Each one is mostly run on its own by a separate team. Analysts should not query these systems directly, for four reasons:
- Silos. The data is spread across many systems, so one question cannot easily combine it.
- Wrong shape. Schemas and layouts that suit single-record work are poor for big scans.
- Load. A heavy report can slow down real users.
- Access. The OLTP system may sit on a network that analysts are not allowed to reach, for security or compliance reasons.
A warehouse is its own database, kept apart so analysts can run heavy queries without hurting OLTP users. It keeps a copy of what every OLTP system holds, which analysts read but do not change, stored in a layout that suits analysis (a later chapter shows how).
From app databases to a warehouse
Step 1 of 5
Each app has its own database, busy with small reads and writes from riders: unlock a bike, pay, check a station.
- ETL (extract, transform, load): pull data out of each OLTP system, either as a periodic dump or as a steady stream of changes, reshape it into an analysis-friendly schema, clean it up, then load it into the warehouse.
- ELT: the same steps, but you load first and transform inside the warehouse.
- Sources can also be outside software services, like a customer database, an email marketing tool, or a card payments provider, that you can only reach through their API. Copying that data into your own warehouse lets you ask questions their API cannot answer. Some companies sell ready-made connectors that do this copying.
- HTAP (hybrid transactional/analytical processing) tries to do both jobs in one system, with no ETL. Many HTAP products are really an OLTP engine and a separate analytics engine behind one front door.
- HTAP does not replace the warehouse. Good practice is for each operational service to have its own database, which can mean hundreds of them. Analysts still want one warehouse so they can join all the data in one query.
- HTAP suits a single app that needs both big scans and fast reads and writes of single records, such as fraud checks.
- The wider trend: as load grows, systems become more specialized. A general-purpose database is fine while you are small, but specialized systems win as you grow.