Why the relational model cracked at web scale — and the four NoSQL families that replaced it
| Time | Segment | Activity |
|---|---|---|
| 0–8 min | Recap & Framing | Where Lectures 1–10 left us; the question this module answers |
| 8–22 min | The Breaking Point | Three forces that outgrew the relational model |
| 22–35 min | Scaling Models | Vertical vs horizontal; why sharding kills joins |
| 35–50 min | CAP & Consistency | CAP theorem, ACID vs BASE, business consequences |
| 50–68 min | The Four Families | Key-value, document, column-family, graph — with real systems |
| 68–80 min | Decision Framework | Group exercise: pick a database for three scenarios |
| 80–88 min | Atlas Lab | Create a free cluster and a database user |
| 88–90 min | Wrap-Up | Assignment 1 brief and Lecture 12 preview |
The relational model is one of the most successful ideas in computing. Edgar Codd published it in 1970; by 1990 it was the undisputed default, and it remains the correct answer for a large share of business systems. Nothing in this module argues that SQL is obsolete. The argument is narrower and more useful: between roughly 2004 and 2010, a specific set of workloads appeared that the relational model served badly, and the industry built new tools for them.
Understanding which workloads those are is the difference between a manager who picks technology on merit and one who picks it on fashion.
A relational database is designed around one authoritative server. You make it faster by making that server bigger. That strategy works beautifully until your dataset no longer fits on the largest server money can buy — and by the mid-2000s, Google, Amazon, and Facebook had crossed that line.
Scale in context: A well-tuned PostgreSQL instance comfortably handles terabytes. The companies that invented NoSQL were managing petabytes — a thousandfold difference. If your data fits on one big server, the relational model is almost certainly still your best option.
A relational table requires you to declare every column, with its type, before you insert a single row. That rigidity is a feature: it guarantees structure. It becomes a liability when the business changes shape faster than the schema can be migrated.
Consider a product catalogue. A book has an author, an ISBN, and a page count. A refrigerator has a capacity in litres, an energy rating, and a door configuration. A pair of shoes has a size, a colour, and a material. In a relational schema you resolve this with one of three unattractive options:
| Option | How It Works | What It Costs |
|---|---|---|
| One wide table | Every attribute of every product type becomes a column | Hundreds of mostly-NULL columns; adding a product type means an ALTER TABLE |
| Table per type | A separate table for books, appliances, footwear | Querying "all products under ₹2,000" means a UNION across dozens of tables |
| Entity-Attribute-Value | One generic table of (product, attribute, value) rows | Everything is a string; the database can no longer validate or index meaningfully |
A document database sidesteps the dilemma: each product is a document, and each document carries exactly the fields that product needs.
Application code works with nested objects. A customer has a list of addresses, which each have a postcode. Relational storage cannot nest, so that single conceptual object is shredded across three or four tables on write and reassembled with joins on read.
// What the application wants to work with
{
name: "Priya Sharma",
addresses: [
{ type: "home", city: "Delhi", pin: "110001" },
{ type: "work", city: "Gurgaon", pin: "122002" }
]
}
// What a relational schema requires
customers(id, name)
addresses(id, customer_id, type, city, pin)
-- plus a JOIN on every single read
The business translation: impedance mismatch is not an aesthetic complaint. It is paid for in developer hours — writing mapping layers, debugging join logic, and managing migrations. For a product team shipping weekly, that overhead is a direct drag on time-to-market.
This single distinction explains most of what follows, so it is worth getting precisely right.
Buy a bigger machine: more CPU, more RAM, faster disk. Simple, requires no application change, and keeps all data in one place so joins and transactions stay easy.
Limits: cost rises faster than capacity, there is a hard physical ceiling, and the machine remains a single point of failure.
Add more commodity machines and spread the data across them. Capacity grows almost linearly, cost stays proportional, and losing one node need not take the system down.
Limits: the data is now distributed, which makes joins, transactions, and consistency genuinely hard.
Sharding means splitting a dataset across servers by some key — customers A–M on Server 1, N–Z on Server 2. Each server independently handles its slice, which is exactly what makes horizontal scaling work.
Now run a join. SELECT ... FROM orders JOIN customers requires matching every order against every customer. If orders live on Server 1 and the matching customers live on Server 2, the database must ship data across the network mid-query. On a dataset of any size, this is catastrophically slow.
The core insight of NoSQL: rather than making distributed joins fast — which is close to impossible — restructure the data so the join is never needed. Store the order with its customer details embedded. You trade some duplication for the ability to scale horizontally. Every design decision in this module descends from that trade.
Eric Brewer's CAP theorem (2000) is the most cited and most misquoted idea in distributed data. Stated carefully, it says that a distributed system can guarantee at most two of three properties:
| Property | Meaning | If You Lose It |
|---|---|---|
| C — Consistency | Every read returns the most recent write | Different users may briefly see different answers |
| A — Availability | Every request receives a response | Some requests fail or time out |
| P — Partition tolerance | The system keeps working when the network splits | A network fault takes the whole system down |
The correction most people need: you do not get to choose whether to have partitions. Networks fail — cables are cut, switches reboot, data centres lose connectivity. Partition tolerance is therefore mandatory for any real distributed system. The genuine choice is what to do during a partition: refuse requests to protect correctness (CP), or answer them and reconcile afterwards (AP).
Make it concrete. The network between two data centres fails. Each side can still serve customers, but they cannot talk to each other.
Scenario: a bank transfer. The system refuses the transaction rather than risk double-spending the same balance.
Customer sees: "Service temporarily unavailable."
Systems: MongoDB (default), HBase, Redis in cluster mode.
Scenario: a shopping cart. Accept the item now and reconcile the two versions when the network heals — a slightly stale cart beats a lost sale.
Customer sees: a working site.
Systems: Cassandra, DynamoDB, CouchDB.
These are the two consistency philosophies that follow from the CAP choice.
| ACID (traditional) | BASE (distributed) | |
|---|---|---|
| Stands for | Atomicity, Consistency, Isolation, Durability | Basically Available, Soft state, Eventual consistency |
| Promise | A transaction fully succeeds or fully fails; the data is never in between | The system always answers; replicas converge shortly afterwards |
| Optimises for | Correctness | Availability and scale |
| Right for | Payments, ledgers, inventory, bookings | Feeds, recommendations, analytics, telemetry, sessions |
| Wrong for | Workloads needing global write scale | Anything where a stale read costs real money |
How the debate actually resolved: the hard either/or of 2010 has softened. MongoDB has supported multi-document ACID transactions since version 4.0 (2018), and most cloud databases now let you choose a consistency level per operation. The modern skill is not picking a camp — it is knowing which guarantee each individual operation requires.
"NoSQL" is an unhelpfully broad label — it describes what these systems are not. The useful taxonomy is by data model, and there are four.
The simplest possible model: a giant dictionary. You supply a key, you get back a value, and the database does not inspect or interpret that value.
SET user:8471:session "{token: 'a9f3...', expires: 1735689600}"
GET user:8471:session
Strength: extraordinary speed — sub-millisecond lookups, because there is no query planning to do. Weakness: you can only retrieve by key. There is no "find all sessions expiring today" unless you build that index yourself.
Systems: Redis, Amazon DynamoDB, Memcached, etcd. Typical uses: caching, session storage, rate limiting, leaderboards, real-time counters.
You will work with Redis directly in Lectures 17–18, building a live analytics dashboard on top of its bitmap and counter structures.
The value is no longer opaque. Each record is a structured document — typically JSON — and the database can query inside it, index nested fields, and enforce optional validation rules.
{
"_id": "CNR3000142",
"status": "Completed",
"vehicle_type": "Go Sedan",
"route": { "pickup": "Connaught Place", "drop": "Aerocity" },
"booking_value": 412.50,
"ratings": { "driver": 4.6, "customer": 4.8 }
}
Strength: the stored shape matches the application's shape, so the impedance mismatch disappears. Related data lives together, which removes most joins. Weakness: data duplicated across documents must be kept consistent by the application.
Systems: MongoDB, Couchbase, Firestore, DocumentDB. Typical uses: product catalogues, user profiles, content management, event and booking records.
This is the family the course focuses on. Lectures 12–16 are built entirely on MongoDB.
Data is stored by column rather than by row. Reading one column across a billion rows touches only that column's data on disk instead of dragging every other field along with it.
Strength: enormous write throughput and very fast aggregation over single attributes. Weakness: the data model is rigid and query patterns must be designed up front — you cannot explore ad hoc.
Systems: Apache Cassandra, HBase, ScyllaDB, Google Bigtable. Typical uses: time-series and sensor data, message histories, write-heavy telemetry at scale.
The relationships are the data. Nodes represent entities and edges represent connections, both of which can carry properties.
(Priya)-[:PURCHASED]->(iPhone 15)
(Priya)-[:FOLLOWS]->(Rahul)-[:PURCHASED]->(AirPods)
// "What did people Priya follows buy?" — one hop, not a 5-table self-join
Strength: traversing relationships is constant-time regardless of total dataset size, which is exactly where SQL degrades. Weakness: poor at bulk aggregation; a smaller talent pool.
Systems: Neo4j, Amazon Neptune, ArangoDB, TigerGraph. Typical uses: fraud rings, recommendation engines, social networks, supply-chain and ownership mapping.
| Family | Query By | Best At | Avoid When | Flagship |
|---|---|---|---|---|
| Key-Value | Key only | Raw speed, caching | You need to search by value | Redis |
| Document | Any field | Flexible, evolving records | Heavy multi-entity joins | MongoDB |
| Column-Family | Partition + clustering key | Massive write volume | Ad-hoc exploration | Cassandra |
| Graph | Traversal | Deep relationships | Bulk aggregation | Neo4j |
| Relational | SQL | Transactions, reporting | Petabyte horizontal scale | PostgreSQL |
You will rarely write the migration yourself. You will frequently be in the room when the choice is made, and the questions below are the ones that actually settle it.
What is the access pattern? Write down the three queries the system will run most often. Choose the database that serves those three well — not the one with the best feature list.
How much does a stale read cost? If the answer is "a rupee", you need ACID. If it is "a slightly out-of-date view count", eventual consistency is fine and far cheaper.
How fast does the schema change? Monthly changes to the shape of a record favour a document model. A stable schema that has not moved in three years favours relational.
What is the realistic data volume in three years? Be honest. Most systems never leave single-server territory, and adopting a distributed database you do not need imports complexity for free.
Who will operate it at 3 a.m.? The best database for a team that cannot run it is the wrong database. Managed services such as MongoDB Atlas exist largely to answer this question.
In groups, choose a family for each and defend it in one sentence.
| # | Scenario | Decisive Question |
|---|---|---|
| 1 | A ride-hailing firm stores 150,000 bookings a year. Fields differ by product line, and analysts need ad-hoc queries on any attribute. | Flexible shape + query any field |
| 2 | An e-commerce site must show a live "trending products in the last 5 minutes" strip on every page load. | Sub-millisecond reads; staleness is harmless |
| 3 | An insurer wants to find rings of claimants who share addresses, phone numbers, and repair garages. | Relationship depth, not volume |
Intended answers: (1) Document — this is precisely the Uber dataset you will model from Lecture 12 onward. (2) Key-value — Redis, which you will build in Lecture 17. (3) Graph — a fraud ring is a traversal problem, and SQL self-joins collapse beyond three hops.
| Myth | Reality |
|---|---|
| "NoSQL means no SQL" | It means "not only SQL". Several NoSQL systems ship SQL-like query languages. |
| "NoSQL has no schema" | The schema moves from the database into the application — and it is still there. MongoDB also offers explicit schema validation. |
| "NoSQL cannot do transactions" | MongoDB has supported multi-document ACID transactions since 4.0 (2018). |
| "NoSQL is always faster" | Only for the access patterns it was designed for. A badly modelled document database is slower than a well-indexed SQL table. |
| "NoSQL replaces relational" | Most large organisations run both. The term for this is polyglot persistence — the right store for each job. |
Everything from Lecture 12 onward needs a running MongoDB cluster. The free M0 tier is permanent, requires no credit card, and gives you 512 MB — comfortably more than this course needs.
Go to mongodb.com/cloud/atlas/register and sign up. Use your student email — it also unlocks the MongoDB Student Pack.
Create a project named BDMA, then Build a Cluster → choose the M0 Free tier.
Pick the region closest to you (ap-south-1 / Mumbai for India). Region affects latency, not cost, on the free tier.
Security → Database Access → Add New User. Create user bdma_student with a password you record somewhere safe. Grant readWriteAnyDatabase.
Security → Network Access → Add IP Address → Allow Access from Anywhere (0.0.0.0/0). This is acceptable for a teaching cluster only — never for production.
Connect → Drivers and copy your connection string. It looks like the line below. Save it; Lecture 12 starts here.
mongodb+srv://bdma_student:<password>@cluster0.xxxxx.mongodb.net/Never commit a connection string to GitHub. It contains a live password. Automated scanners find exposed Atlas credentials within minutes of a public push. Keep it in a local .env file and add that file to .gitignore.
We move from theory to the keyboard. You will learn how BSON documents are structured, make the central modelling decision of embedding versus referencing, and load your first collection into the Atlas cluster you just created. Bring your connection string.