Non-Relational Databases
The same problem-first depth, applied to the systems that trade the relational model away on purpose.
13
Acts
99
Chapters
GreenMart
The Story
The Index
13 Acts. 99 Chapters. One continuous story.
Opening the Doors to Everyone
GreenMart opens its platform to outside sellers, and the old schema can't hold what walks in.
What Is NoSQL?
The Sellers Who Don't Fit the Form
The Four NoSQL Data Models
More Than One Way to Shape Data
Access-Pattern-Driven Design
Design for the Question, Not the Table
Replication & Partitioning
Copies Everywhere
The CAP Theorem
You Can't Have It All
Polyglot Persistence
One Size Never Fits All
Diagnose GreenMart's Marketplace Problem
Every Shape Its Own Box
Sarah rebuilds the marketplace catalog on documents, not rows.
The Document Model
Every Seller Gets Their Own Shape
Embedding vs. Referencing
Inside the Box or Down the Hall?
Reading & Querying Documents
Finding Exactly What You Need
Inserting & Updating Documents
A Hundred New Products by Morning
Deleting Documents & Logical Operators
When a Listing Has to Disappear
The Aggregation Pipeline
Turning Listings Into Answers
Indexes & Query Performance
Finding a Product Without Scanning Everything
Replication & Replica Sets
Copies That Keep Selling
Sharding & Shard Keys
Splitting the Catalog Across Machines
Model GreenMart's Marketplace Catalog
The Sale That Outran the Database
A flash sale slows GreenMart down again — this time it's speed, not correctness.
Why Redis Isn't Just a Cache
The Sale That Slowed Everything Down
Redis Data Structures
More Than Strings
TTL, Sessions & Caching Patterns
Remembering Without Forgetting to Forget
Atomic Operations & Distributed Locks
Nobody Sells the Last Item Twice
Pub/Sub, Queues & Leaderboards
Announcements Everyone Hears at Once
Persistence & Durability
What Happens If Redis Restarts
Replication & High Availability
Enough Copies to Survive Anything
Scaling, Hot Keys & Failure Scenarios
Running Redis Like You Mean It
Design GreenMart's Flash-Sale Cache
Going National, Then Global
GreenMart moves to the cloud and stops wanting to run its own database cluster.
The DynamoDB Data Model
Someone Else Runs the Servers Now
Access Patterns, Query vs. Scan
Design the Questions First
Single-Table Design & Secondary Indexes
One Table to Rule the Marketplace
Conditional Writes, Transactions & Consistency
Promises the Database Keeps Without Asking
Capacity, Hot Partitions & Serverless Cost
Paying for What You Actually Use
Global Tables & Multi-Region
The Same Table, Everywhere
Design GreenMart's Order-Tracking Table
A Fleet That Never Stops Talking
GreenMart's new delivery fleet streams data nonstop, from every truck, in every region.
Why the Fleet Needs a Different Database
A Truck Every Second, From Everywhere
Wide-Column Modelling & Partition Keys
Design Around the Question the Truck Asks
The Ring, Gossip & Coordinator Nodes
No Single Machine in Charge
Replication Factor, Quorum & Tunable Consistency
How Sure Do You Need to Be?
Memtables, SSTables & Compaction
What Actually Happens on Write and Read
Failure Handling & Multi-Datacenter Deployment
When a Node Goes Dark
Design GreenMart's Fleet-Tracking Keyspace
The Ring Nobody Saw
A fraud ring hides inside a network of fake accounts — until the relationships themselves become the data.
Why the Relationship Itself Is Data
A Ring of Accounts That Looks Normal, One at a Time
The Property Graph Model
Nodes, Edges, and the Shape Between Them
Traversals, Cypher & Pattern Matching
Asking the Database to Walk
Fraud Detection & Shortest Paths
Following the Money Without a Join
Recommendations & Graph Algorithms
Also Bought, Also Trusted
Graph Performance & When Not to Use One
When the Graph Gets Too Big to Eyeball
Trace GreenMart's Fraud Ring
Finding It Anyway
The catalog outgrows plain text matching, typos and all.
Why a Database Query Isn't a Search
Close Enough Should Still Find It
The Inverted Index & Tokenization
Breaking Words Apart to Find Them Again
Relevance, Scoring & Query Types
Not Just Found — Ranked
Faceted Search & Filtering
Narrowing Down a Big Catalog
Shards, Replicas & Distributed Search
A Search Cluster of Its Own
Index Lifecycle, Mapping & Search Performance
Keeping a Moving Target Fast and Current
Build GreenMart's Product Search
Watching GreenMart in Real Time
Mike finally wants real dashboards — sales, sensors, and server health, read as trends, not rows.
What Makes Time-Series Data Different
A Number Means Nothing Without Knowing When
High-Frequency Writes & Time-Based Partitioning
A Write Every Second, From Every Truck
Downsampling, Rollups & Retention
Yesterday in One Chart, Not a Million Rows
Out-of-Order Data & Continuous Aggregation
The Reading That Arrived Late
Cardinality & Observability at Scale
Too Many Things to Watch
Build GreenMart's Operations Dashboard
Show Me Something Like This
GreenMart's new shopping assistant has to understand meaning, not just keywords.
What a Vector Actually Is
Close in Meaning, Not in Spelling
Embeddings & Semantic Similarity
Turning a Photo Into a Search Query
Approximate Nearest-Neighbor Search
Fast Enough to Feel Instant
Hybrid Search & Metadata Filtering
Meaning Plus Filters
Retrieval & RAG
Where the Assistant's Answers Actually Come From
Vector DB vs. Traditional DB
One More Database, or the Same One With pgvector?
Wire Up GreenMart's Shopping Assistant
Two Phones, Two Truths
Keeping every screen in sync turns out to be a harder problem than storing the data ever was.
The Problem Isn't Storage, It's Sync
Two Phones, Two Different Truths
Realtime Listeners & Subscriptions
The Database Tells You, You Don't Ask It
Optimistic UI & Offline-First
Answering Before the Server Does
Security Rules & Authorization
Who's Allowed to See This Order
BaaS vs. Self-Managed, Cost & Lock-In
Trading Control for Speed
Sync GreenMart's Live Order Tracker
Seven Databases Later
Sarah counts the databases GreenMart is now running, and doesn't love the number.
The Cost of Specialization
Seven Databases and One Tired Team
What a Multi-Model Database Offers
One System, Several Shapes of Data
Consolidation Trade-offs
What You Gain, What You Give Up
Multi-Model vs. Specialized
When to Merge, When to Stay Separate
Audit GreenMart's Database Sprawl
The Sale Where the Regions Disagreed
GreenMart's biggest sale yet hits a real network partition — and for a while, nobody agrees on the truth.
The Incident, in Real Time
The Sale Where Two Regions Disagreed
Why Distribute Data & Scaling Up vs. Out
Why Spread Out At All?
Network Partitions & the CAP Theorem
So What Actually Just Happened?
PACELC & Consistency Models
The Trade-Off That Never Fully Goes Away
Replication Topologies
Who Actually Holds the Data?
Quorum Mathematics
The Real Arithmetic of Agreement
Causal Consistency & Read-Your-Writes
What You See Depends on Who You Are
Partitioning & Consistent Hashing
Splitting the Load Without Losing the Plot
Consensus & Leader Election
Agreeing on One Answer, Together
Split-Brain & Conflict Resolution
When Both Sides Think They're In Charge
Distributed Transactions & Two-Phase Commit
A Promise That Spans Machines
Failover, Disaster Recovery & Multi-Region Design
Planning for the Next Outage
Fix GreenMart's Split-Brain Incident
Choosing What Comes Next
GreenMart's next expansion is on the table, and this time Sarah has to argue for the right database, not just pick one.
Workload Analysis & Data Shape
Every Requirement Is a Clue
Consistency, Availability & Latency Requirements
The Guarantees You're Actually Promising
Scale, Volume & Geographic Requirements
How Big, How Fast, How Far
Operational Complexity, Cost & Team Expertise
Who Has to Run This, and What It Costs
Vendor Lock-In, Compliance & Future Growth
The Requirements Nobody Asks About Until It's Too Late
Real-World Comparisons
Same Problem, Different Databases
Building a Decision Framework
The Question That Actually Matters
GreenMart's Next Expansion
Course Complete