Intro to Databases: Understanding OLAP, OLTP, Embeddable, and Standalone
Tags: datascience, database, embeddabledatabases, olap
Published: 2024-01-17 17:23:38

---
title: Intro to Databases: Understanding OLAP, OLTP, Embeddable, and Standalone
published: true
date: 2024-01-16 08:00:00 UTC
tags: datascience,Databases,EmbeddableDatabases,OLAP
canonical_url: https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/
---

![](https://diegocarrasco.com/images/social-images/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone.jpg)

 

- [TLDR](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#tldr)
- [Introduction to Databases](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#introduction-to-databases)
- [Why this article?](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#why-this-article)
- [What is OLAP?](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#what-is-olap)
- [What is OLTP?](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#what-is-oltp)
- [What is Embeddable?](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#what-is-embeddable)
- [What is Standalone?](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#what-is-standalone)
- [Understanding the differences](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#understanding-the-differences)
  - [OLAP vs OLTP](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#olap-vs-oltp)
  - [Embeddable vs Standalone](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#embeddable-vs-standalone)
- [Conclusion](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#conclusion)
- [References](https://diegocarrasco.com/intro-to-databases-understanding-olap-OLTP-embeddable-and-standalone/#references)

### TLDR

Databases are essential if you work with computers, varying in type and purpose. OLAP and OLTP represent different data processing approaches, while embeddable and standalone databases differ in their integration with applications. This article serves as an introductory guide to these concepts.

### Introduction to Databases

If you have ever worked with computers, you have probably heard of databases. They are the (usually correct) way for storing and managing data efficiently. While some (of us) still use Spreadsheets as a database, there are many types of actual databases, each with its own purpose and advantages.

Databases are used in almost every application, from simple blogs running WordPress to complex ERPs. They are used in banking, e-commerce, and even in your smartphone.

That said, databases are pivotal in storing and managing data efficiently if you work with data. With various types available, understanding the basics, like OLAP, OLTP, embeddable, and standalone databases, is important, but regrettably not enough, for choosing the right database for your needs. but we need to start somewhere.

### Why this article?

A few weeks ago I found out about [DuckDB](https://duckdb.org/), an embeddable SQL OLAP database that can be used with Python ([and many other](https://duckdb.org/docs/api/overview)). I was curious about its positioning as an OLAP database, and I found a mention to [this paper](https://hannes.muehleisen.org/publications/SIGMOD2019-demo-duckdb.pdf) in [Reddit](https://www.reddit.com/r/sqlite/comments/13np8ik/comment/jl6adp5/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) where I found this graphic:

![Systems Landscape from the paper "DuckDB: an Embeddable Analytical Database"](https://diegocarrasco.com/images/db-landscpae-from-duckdb-paper.png)

And I thought interesting to dive a bit deeper into the concepts of OLAP, OLTP, embeddable, and standalone databases.

So here we are.

### What is OLAP?

OLAP ( **Online Analytical Processing** ) is a type of database designed for complex queries, data analysis, and reporting. It's often used in business intelligence and data warehousing, allowing users to analyze data from multiple perspectives.

> OLAP is an approach to answer multidimensional analytical (MDA) queries swiftly in computing. Typical applications of OLAP include business reporting for sales, marketing, management reporting, business process management (BPM), budgeting and forecasting, financial reporting and similar areas. OLAP tools enable users to analyze multidimensional data interactively from multiple perspectives.
> 
> -- Automatic Summary from [Wikipedia](https://en.wikipedia.org/wiki/Online_analytical_processing) using [this script](https://github.com/dacog/Hugging-Face-Transformers-Language-Models-Exploration#summarize)

An example of an OLAP database is a data warehouse that stores historical data from multiple sources. It allows users to analyze data from different perspectives, like sales by region, product, or time.

Database that are in this category are:

- [Amazon Redshift](https://aws.amazon.com/redshift/): A fully managed, petabyte-scale data warehouse service in the cloud.
- [Snowflake](https://www.snowflake.com/): A cloud-based data platform that provides a data warehouse as a service designed for the cloud.
- [BigQuery](https://cloud.google.com/bigquery): A serverless, highly scalable, and cost-effective cloud data warehouse designed for business agility.
- [DuckDB](https://duckdb.org/): An embeddable SQL OLAP database that can be used with Python and many other languages.
- [ClickHouse](https://clickhouse.tech/): An open-source OLAP database management system developed by Yandex. It is column-oriented and allows to generate analytical reports using SQL queries in real-time.

### What is OLTP?

OLTP ( **Online transaction processing** ) databases are optimized for managing transaction-oriented applications, like e-commerce systems, banking, and reservation systems.

> Online transaction processing (OLTP) is a type of database system used in transaction-oriented applications, such as many operational systems. "Online" refers to that such systems are expected to respond to user requests and process them in real-time (process transactions) The term is contrasted with online analytical processing ( OLAP) which instead focuses on data analysis.
> 
> -- Automatic Summary from [Wikipedia](https://en.wikipedia.org/wiki/Online_transaction_processing) using [this script](https://github.com/dacog/Hugging-Face-Transformers-Language-Models-Exploration#summarize)

An example of an OLTP database is a banking system that stores customer information and transactions. It allows users to perform transactions like deposits, withdrawals, and transfers.

Database that are in this category are:

- [MySQL](https://www.mysql.com/) : An open-source relational database management system.
- [MariaDB](https://mariadb.org/): An open-source relational database management system, and a fork of MySQL before being acquired by Oracle.
- [PostgreSQL](https://www.postgresql.org/): An open-source object-relational database management system.
- Oracle: A relational database management system developed by Oracle Corporation.
- SQL Server: A relational database management system developed by Microsoft.
- [SQLite](https://www.sqlite.org/index.html): A relational database management system that is embedded into the end program.

### What is Embeddable?

Embeddable databases can be directly integrated into an application's software. They run within the application’s process, making them ideal for desktop applications, small-scale web applications, or for use in portable devices.

Database that are in this category are:

- [SQLite](https://www.sqlite.org/index.html): A relational database management system that is embedded into the end program.
- [DuckDB](https://duckdb.org/): An embeddable SQL OLAP database that can be used with Python and many other languages.
- [H2](https://www.h2database.com/html/main.html): An embeddable RDBMS written in Java.
- [Firebird](https://firebirdsql.org/): An open-source SQL relational database management system.
- [HSQLDB](http://hsqldb.org/): An open-source relational database management system written in Java.

### What is Standalone?

Standalone databases operate separately from the application. They require their server process and are accessed over a network. This type is suitable for large-scale applications that require robust database management systems.

Database that are in this category are:

- [MySQL](https://www.mysql.com/) : An open-source relational database management system.
- [MariaDB](https://mariadb.org/): An open-source relational database management system, and a fork of MySQL before being acquired by Oracle.
- [PostgreSQL](https://www.postgresql.org/): An open-source object-relational database management system.

### Understanding the differences

#### OLAP vs OLTP

OLAP and OLTP are two different approaches to data processing. OLAP is used for complex queries and data analysis, while OLTP is used for transaction-oriented applications.

**Transaction-oriented** means that the database is optimized for handling transactions, which are a set of operations that must be executed as a whole. For example, when you buy something online, the transaction is the whole process of adding the item to the cart, entering your payment information, and confirming the purchase.

OLAP databases are optimized for complex queries and data analysis. They are used in business intelligence and data warehousing, allowing users to analyze data from multiple perspectives.

#### Embeddable vs Standalone

Embeddable databases can be directly integrated into an application's software. They run within the application’s process, making them ideal for desktop applications, small-scale web applications, or for use in portable devices. But they also have a sweet spot in data science and machine learning applications, where they can be used to store data without the need for a separate database server.

After playing with it for a bit, I realized that DuckDB may not perform as quickly when handling a few thousand rows of data and big json columns. However, it offers user-friendly data access, seamless integration with pandas and PyCharm, and is excellent for experimentation. Nevertheless, I eventually switched to using PostgreSQL. 

Standalone databases operate separately from the application. They require their server process and are accessed over a network. This type is suitable for large-scale applications that require robust database management systems. In data science and machine learning applications, they are used for storing large amounts of data, and you can also run them using Docker, if you want to avoid the whole setup process.

With embeddable databases, you can store data in a single file, which is easier to manage and move around, and you just need to install the database driver to use it. With standalone databases, you need to install the database server, the client and everything in between.

### Conclusion

Understanding these basic database concepts is crucial but not enough for selecting the right database type for your specific needs. Each type offers unique advantages depending on the application's requirements and your use case.

### References

- Introduction to OLAP: [OLAP Basics](https://www.olap.com/learn-bi-olap/olap-definition/)
- Understanding OLTP: [OLTP Overview](https://www.techopedia.com/definition/24404/online-transaction-processing-oltp)
- Embeddable vs Standalone Databases: [Database Types](https://www.databasestar.com/embeddable-vs-standalone-databases/)
- [Reddit comment](https://www.reddit.com/r/sqlite/comments/13np8ik/comment/jl6adp5/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)
- [Paper PDF](https://hannes.muehleisen.org/publications/SIGMOD2019-demo-duckdb.pdf)
- [duckDB Site](https://duckdb.org/)