Analytical Databases
While OLTP (Online Transaction Processing) databases handle day-to-day operations, data warehouses are optimized for OLAP (Online Analytical Processing) β complex queries that analyze large volumes of historical data for business intelligence.
OLTP vs. OLAP
OLTP (Transaction) OLAP (Analytical)
βββββββββββββββββββββ βββββββββββββββββββββ
Current data Historical data
Small, fast operations Large, complex queries
Many concurrent users Few analysts
Row-oriented storage Column-oriented storage
Normalized schema Denormalized schema
e.g., MySQL, PostgreSQL e.g., Redshift, BigQuery
Star Schema
The most common data warehouse design:
βββββββββββββββ
β Dim_Date β
β DateKey β
β Year β
β Month β
ββββββββ¬βββββββ
β
ββββββββββββββ ββ΄ββββββββββββββ ββββββββββββββ
β Dim_Productββββββ Fact_Sales ββββββ Dim_Customerβ
β ProductKey β β DateKey β β CustomerKey β
β Name β β ProductKey β β Name β
β Category β β CustomerKey β β Region β
ββββββββββββββ β Quantity β ββββββββββββββ
β Amount β
ββββββββββββββββ
β
βββββββ΄βββββββ
β Dim_Store β
β StoreKey β
β Location β
ββββββββββββββ
Fact table = measurements (sales, quantities)
Dimension tables = context (who, what, when, where)