We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
2 system design questions lean on this idea. Each walks through the full answer.
System Design Masterclass · Database Fundamentals
Free preview: the first 2 parts of this 8-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 Database 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
The previous lesson ended with one measurement that favoured the flat table: a join cost 1.34 times. That is a real cost and it is a weak argument for keeping a second copy of anything.

Denormalizing is usually justified by the cost of joins. The real case is precomputation: work that happens once per write instead of once per read.
Nothing in this lesson makes anything faster. The sum over two million rows still happens; it happens at a different moment, and the whole trade is how often each moment occurs.

The lab starts a PostgreSQL on a scratch directory, builds two million orders, and tears the whole thing down afterwards.

The live query joins two million orders to fifty thousand customers and aggregates. The summary holds six rows. Both return identical numbers, checked row by row.
That last check matters more than the ratio. The two agreed because the summary had just been built from the source, and everything else in this lesson is about what it takes to keep that true.

This framing turns the decision into arithmetic. A value read a thousand times per write is obviously worth precomputing, and a value read once per write is obviously not.
It is easy and good
“It is really nice and good Please join the course”