- Row store = suitcases. Each traveller's things are packed together, like one row with all its columns.
- OLTP: check in one traveller. Open one suitcase and you have everything. Fast.
- Count every shoe? With suitcases you must open all of them.
- Column store = wardrobes. The same things, sorted by type.
- OLAP: count every shoe. Open one wardrobe. That's why analytics uses columnstores.
OLTP vs OLAP: At a Glance
OLTP 🏃♀️
- Purpose: Day-to-day operations
- Data: Real-time, current
- Queries: Simple, fast (Read/Write)
- Database: Typically row-based storage
OLAP 🧠
- Purpose: Analysis & decision making
- Data: Historical, aggregated
- Queries: Complex, multi-dimensional
- Database: Typically columnar storage
OLTP: Normalized & ER Diagrams
Highly normalized to reduce redundancy, often visualized with ER diagrams where central entities are linked to attributes.
Primary Keys & Indexes
A primary key (like 'OrderID') uniquely identifies each row. Fast lookups come from indexing, and how rows are physically stored depends on the indexes and storage engine.
OLAP: Star Schema
Uses Star Schemas where a central fact table (like 'Sales') is surrounded by dimension tables.