Let's reason from first principles instead of memorizing rules.
Suppose a query needs data spread across n tables. To combine them the database performs joins. A nested-loop join of two tables of sizes R and S costs roughly O(R⋅S) rows examined without indexes, or O(RlogS) with an index on S. Chaining n tables multiplies this work.
What does denormalization trade, and in which direction?
State the inequality for when to denormalize.
Name three denormalization techniques.
Why must duplicated data be "guarded"?
Give one case where you should not denormalize.
Recall Feynman: explain to a 12-year-old
Imagine your toy box is super tidy: cars in one box, wheels in another, stickers in a third (that's normalized — nothing is repeated). But every time you want to play with a finished car, you must run to three boxes and assemble it — slow! So you keep a few fully-built cars ready on the shelf (that's denormalized — copies, fast to grab). The catch: if you repaint the real cars, you must remember to repaint the shelf copies too, or they'll look wrong. You only keep ready-made copies of the toys you play with all the time, not the ones you barely touch.
Dekho, normalization ka matlab hai data ko chhoti chhoti tables mein todna taaki koi cheez do jagah repeat na ho. Isse write safe rehta hai — ek fact sirf ek jagah, toh kabhi contradiction nahi hota. Lekin problem ye hai ki jab data padhna (read) ho, toh database ko sab tables ko JOIN karke wapas jodna padta hai, aur ye slow ho jaata hai, especially jab tables badi hon.
Denormalization isi ka ulta soch ke kiya jaata hai — hum jaan-boojh kar thoda redundancy (duplicate data) wapas daal dete hain taaki read fast ho jaaye. Jaise orders table mein total_amount directly store kar do, har baar order_items se SUM lagane ki zaroorat nahi. Cost kahin nahi jaati — bas read se hatke write par chali jaati hai, kyunki ab duplicate copy ko sync mein rakhna padta hai (trigger ya app logic se).
Decision ka simple rule: jab tum bahut zyada read karte ho aur kam write, tab denormalize karo. Formula yaad rakho: fr/fw>Csync/Cjoin — yaani read/write ratio cost ratio se bada hona chahiye. Banking ledger jaisi jagah jahan write frequent hai aur exactness critical hai, wahan denormalize mat karo.
Ek important baat — pehle hamesha normalize karo, fir evidence dekh ke denormalize karo. Pehle se hi duplicate banana (premature optimization) bugs laata hai. Aur jo bhi duplicate banao, usko trigger/transaction se guard zaroor karo, warna data "drift" ho jaayega aur galat dikhega. Mantra: "READ fast, WRITE last."