နားလည်ထားရမယ့် အချက်
Normalization ရဲ့ရည်ရွယ်ချက်က update anomaly၊ duplicate facts နှင့် inconsistent data ကိုလျှော့ဖို့ပါ။ User email ကို enrollment row တိုင်းပြန်သိမ်းမည့်အစား user table မှာတစ်ခါသိမ်းပြီး key ဖြင့်ချိတ်ပါတယ်။ ဒါပေမယ့် reporting/performance အတွက် denormalization လုပ်နိုင်ပြီး source of truth နဲ့ sync strategy ကိုရှင်းရပါတယ်။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Tutorial၊ lesson နှင့် user ကို independent entities ခွဲပြီး enrollment ကို many-to-many bridge အဖြစ်ထားမယ်။ Lesson progress ကို enrollment+lesson pair အဖြစ် model လုပ်ခြင်းက user/tutorial fields ထပ်သိမ်းခြင်းထက် constraint များချိတ်ရလွယ်ပါတယ်။
အတူတူ စမ်းရေးကြည့်မယ်
users 1 ───< enrollments >─── 1 tutorials
│
└──< lesson_progress >── 1 lessons
tutorials 1 ───< lessons
Rule: each fact lives once; relationships carry foreign keys.Tutorial Platform entity relationship map တစ်ခုရမည်။၅ မိနစ် စမ်းကြည့်
Comment feature အတွက် author၊ tutorial/lesson target၊ body နဲ့ timestamps ကို duplication မဖြစ်အောင် model ဆွဲပါ။
သတိလေးတစ်ချက်
Normalization level ကို rule ကျက်ပြီးမရွေးပါနှင့်။ Query pattern၊ integrity နဲ့ change frequency ကိုပါစဉ်းစားပါ။
PostgreSQL — Data Definition — PostgreSQL Global Development Group