We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Core Fundamentals
Free preview: the first 2 parts of this 17-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Core Fundamentals
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
"Should we use or NoSQL for this system?"
This question comes up in every system design interview. Every single one. The interviewer is not looking for a one-word answer, they are testing whether you understand the trade-offs deeply enough to make a reasoned decision from the specific requirements in front of you.
Here is the uncomfortable part: most of the popular takes on this are wrong, and they are wrong in a way that is easy to check.
" is faster." Faster at what? Later in this lesson you will see the same data, on the same server, where the document shape is about twice as fast for one query and about three times slower for another.
"SQL does not scale." Instagram runs on PostgreSQL at a scale most companies will never approach.
"NoSQL is for unstructured data." Cassandra makes you declare a schema. DynamoDB makes you declare your keys before you write a single item.
The framing itself is also about fifteen years old. It comes from a period when relational databases genuinely could not scale horizontally, and that turned out to be an engineering limit rather than a law of nature. There is now a whole third category that gives you SQL, joins and transactions on a cluster, and most people arguing about this have never heard of it.
This lesson goes deep. Six database models, what each one physically does, the trade-offs measured rather than asserted, and how to reason about the decision in a real project and in an interview.
Before the models and the acronyms, there is a single decision that everything else follows from, and it has nothing to do with which product you buy.
Where does related data live? Beside the entity it belongs to, or inside it?

Read the left panel and the right panel as answers to the same question, because they are. The data is identical. Only its shape differs.
On the left, orders are a table of their own and each row points back at a user by id. Any question about orders in general is easy, and getting one user with their orders takes a join.
On the right, the orders are a value inside Alice. Getting Alice and her orders takes one read, and there is no way to ask about all orders without opening every user.
That is the whole subject. Everything below is a consequence: joins, schemas, transactions, , and every trade-off in the comparison table at the end.
It is worth saying clearly that this is not a product decision. You can embed JSON in PostgreSQL. You can store normalised references in MongoDB. Choosing a database and choosing a data shape are two separate decisions that people routinely make as one.