Thuta Learning
ရှာဖွေရန်
ExercisesData & Databasesbeginner

Exercise 2 — Performance Incident

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Exercise 2 — Performance Incident concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • နမူနာ SQL/command ကို ကိုယ်တိုင် run ပြီး output စစ်နိုင်ရန်
  • Tutorial Platform project နှင့် production scenario တွင် အသုံးချနိုင်ရန်

နားလည်ထားရမယ့် အချက်

Incident အချိန်မှာ random index/config changes မလုပ်ဘဲ symptom၊ scope၊ recent changes နဲ့ safe evidence ကိုအရင်စုရပါတယ်။ Slow query plan၊ active sessions၊ blockers၊ table stats နဲ့ resource saturation ကိုကြည့်ပြီး mitigation နှင့် root fix ကိုခွဲပါ။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

Catalog endpoint p95 တက်လာသော scenario တွင် read-only diagnostic queries run၊ long transaction terminate လုပ်ရန် approval path၊ missing index test နှင့် rollback criteria ပါသော timeline ရေးမယ်။ Sensitive query text/parameters ကို incident notes ထဲမဖော်ရန်လည်းထည့်ပါ။

အတူတူ စမ်းရေးကြည့်မယ်

sql
SELECT pid, usename, state, wait_event_type, wait_event,
       now() - query_start AS running_for,
       left(query, 120) AS query_sample
FROM pg_stat_activity
WHERE datname = current_database()
ORDER BY query_start;

SELECT relname, seq_scan, idx_scan, n_live_tup, n_dead_tup
FROM pg_stat_user_tables
WHERE schemaname = 'app'
ORDER BY seq_scan DESC;
You should see
Evidence၊ mitigation၊ root-cause hypothesis နှင့် rollback ပါသော incident report ရမည်။

၅ မိနစ် စမ်းကြည့်

Connection pool saturation အတွက် metric သုံးခု၊ alert threshold နှစ်ခုနှင့် safe mitigation သုံးဆင့်ရေးပါ။

သတိလေးတစ်ချက်

Production မှာ `pg_terminate_backend` ကို blocker မသေချာဘဲ run လုပ်ခြင်းက user transaction ကိုဖျက်နိုင်ပါတယ်။

PostgreSQL — Monitoring Database ActivityPostgreSQL Global Development Group

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Production မှာ `pg_terminate_backend` ကို blocker မသေချာဘဲ run လုပ်ခြင်းက user transaction ကိုဖျက်နိုင်ပါတယ်။
  • နမူနာ code ကို production data ပေါ် တိုက်ရိုက်မစမ်းဘဲ local/test database နှင့် recoverable backup ပေါ်တွင် အရင်အတည်ပြုပါ။

လေ့ကျင့်ခန်း

Connection pool saturation အတွက် metric သုံးခု၊ alert threshold နှစ်ခုနှင့် safe mitigation သုံးဆင့်ရေးပါ။

You'll know it worked when: Evidence၊ mitigation၊ root-cause hypothesis နှင့် rollback ပါသော incident report ရမည်။

Exercise 2 — Performance Incident | Thuta Learning