difference between OLTP and OLAP

One way to do this is to create a book that's a bit like a phone book. On each page of this book we store information about a specific user. Now great, we can find information about a specific user very easily! Just jump to the page! If we wanted, we could even have a special page at

Of course it's not that simple. That's why we had to use short tags like OLTP and OLAP in the first place. Each database should ultimately be evaluated independently.

So what is the fundamental difference between OLAP and OLTP?

Well, the database has to store the data somewhere. It should come as no surprise that the way data is stored largely reflects the likely use of said data. Data is usually stored on a hard drive. Let's imagine a hard drive as a very wide sheet of paper into which we can read and write. There are two ways to organize our reads and writes so that they are efficient and fast.

One way to do this is to create a book that's a bit like a phone book. On each page of this book we store information about a specific user. Now great, we can find information about a specific user very easily! Just jump to the page! If we wanted, we could even have a special page at the beginning that tells us which page the user is on. But on the other hand, if we want to find how much money all users spent, then we have to read every page, i.e. the entire book! That would be a row based book/database (OLTP). The optional page at the beginning is the index.

Another way to use large paper is to create an accounting book. I'm not an accountant, but let's imagine we would have a "Spends", "Purchases" page... which is nice because now we can very quickly query something like "Give me total revenue" (just Read the "Buy" page). We could also ask for more involved things like "Give me the top ten products you sell" and still have acceptable performance. But now consider how painful it would be to find a specific user . You have to iterate through the entire list of each person's expenses and filter that specific user's expenses and then add them up. This is basically equivalent to "reading the whole book again". It's a column-based database (OLAP).

It follows:

OLTP databases are designed to perform many small transactions and often act as a "single source of truth."
On the other hand, OLAP databases are better suited for analysis, data mining, fewer queries, but they are usually larger (they operate on more data).
OLTP (Online Transaction Processing) involves the operation of a specific system. OLTP is characterized by a large number of short online transactions (INSERT, UPDATE, DELETE). The main focus of oltp database systems is very fast query processing, maintaining data integrity in a multi-access environment, and effectiveness measured by transactions per second. In an OLTP database, there is detailed, current data, and the schema used to store transactional databases is the entity model (usually 3NF). It involves queries accessing personal records, such as updating emails in a company database.
OLAP (Online Analytical Processing) processes historical or archival data. OLAP is characterized by relatively small transaction volumes. Queries are often very complex and involve aggregations. For OLAP systems, response time is a measure of effectiveness. Data mining techniques are widely used in OLAP applications. In an OLAP database, there is aggregated historical data, stored in a multidimensional schema (usually a star schema). Sometimes queries require access to large amounts of data in administrative records, such as what your company's profits were last year.


lysa karl

41 Blog posts

Comments