Big Data and Data Engineering

BASE Properties; CAP Theorem; OLTP vs OLAP

C-CAT

BASE Properties

What is BASE?

BASE is the consistency model used by NoSQL databases (opposite of ACID):

LetterPropertyDefinition
BABasically AvailableSystem guarantees availability (not every request will get the latest data, but a response)
SSoft StateThe state of the system may change over time (even without new inputs — due to eventual consistency)
EEventually ConsistentSystem will become consistent over time (not immediately; all replicas eventually agree)

Example of Eventual Consistency:

User posts a photo on Instagram (write to primary replica)
Immediately visible on their phone
After 1-2 seconds: visible globally (replicas catch up)
Eventually consistent — not immediately consistent

CAP Theorem

What is CAP Theorem?

CAP Theorem (Brewer's Theorem, 2000): A distributed system can guarantee at most 2 out of 3 properties simultaneously:

PropertyDescription
C — ConsistencyEvery read receives the most recent write or an error
A — AvailabilityEvery request receives a response (not necessarily latest)
P — Partition ToleranceSystem continues operating despite network partitions
         C (Consistency)
             /\
            /  \
           /    \
          /      \
CA ------+--------+ CP
        /          \
       /            \
      /      AP      \
     +________________+
A (Availability)   P (Partition Tolerance)

Network partitions ALWAYS happen in distributed systems → you must choose between C and A.

Database Classification by CAP

TypePrioritizesExamples
CPConsistency + Partition Tolerance (sacrifice Availability)HBase, MongoDB, Redis
APAvailability + Partition Tolerance (sacrifice Consistency)Cassandra, DynamoDB, CouchDB
CAConsistency + Availability (only on single node — no partition)Traditional RDBMS

OLTP vs OLAP

OLTP — Online Transaction Processing

FeatureOLTP
PurposeDay-to-day operations; transactions
DataCurrent, operational data
QueriesSimple CRUD; INSERT, UPDATE, DELETE
Response timeMilliseconds
UsersThousands of concurrent users (clerks, customers)
Data sizeGB
NormalizedHighly normalized (3NF)

Examples: Banking transactions, e-commerce orders, inventory management

OLAP — Online Analytical Processing

FeatureOLAP
PurposeAnalysis, reporting, decision support
DataHistorical, aggregated data
QueriesComplex aggregations, multi-dimensional analysis
Response timeSeconds to minutes
UsersFew analysts and managers
Data sizeTB to PB
DenormalizedStar schema, snowflake schema

Examples: Sales trend analysis, customer behavior analysis, financial reporting

OLTP vs OLAP Comparison

FeatureOLTPOLAP
WhatRecord transactionsAnalyze data
Query typeSimple (INSERT, simple SELECT)Complex (GROUP BY, JOIN across years)
UsersMany concurrent (1000s)Few (10s)
DataCurrent (days)Historical (years)
SchemaNormalizedDenormalized (star/snowflake)
OptimizationFast transactionsFast reads at scale
DatabaseMySQL, PostgreSQLSnowflake, BigQuery, Redshift

Continue learning

Related notes

Put this topic into timed practice

Open mock tests when you want full-exam pacing, or keep drilling in practice mode.